Tagged Questions

A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

learn more… | top users | synonyms (1)

3
votes
3answers
88 views

find 2 files with similar names and move them to a new location

I have a system with a watch folder where people/companies can upload new files via FTP or SMB. In this watch folder They should ALWAYS upload 2 files: 1 media file with a prefix name of ABC*.mxf and ...
2
votes
2answers
110 views

AIX shell script compiler

I know it sounds strange, but is there a good tool that compiles a shell (.sh) script into a executable format? I want to protect the script in such a way it will not be modified by someone. Thanks
-2
votes
3answers
77 views

Can anyone please explain me below AWK script

format of flat file : ;metier_code ; ;-------------------------; (0 rows affected) ;CRDS_Ptf_No; ; ; ; ; ...
2
votes
2answers
141 views

procmail save into a dir and execute a script?

I'm using procmail with Maildir/ and easy rules like the one below to save incoming emails into directories: :0: * ^X-Spam-Status: Yes Spam/ Now I would like a desktop notification on new emails in ...
0
votes
1answer
74 views

Is it possible triggering a script with a change of amount of files in a directory? [duplicate]

Is it possible to create some kind of directory watcher and trigger a script when the folder is not empty? I have a CentOS machine with jenkins CI on it. i would like to create a job that will move ...
2
votes
2answers
166 views

Execute script after period of inactivity

I'm looking for a way to execute certain script after period of inactivity and after completion of that period. By 'inactivity' I mean lack of mouse and keyboard events. E.g. I want: execute first ...
2
votes
1answer
519 views

Change IP remotely over ssh

I am using CentOS. I have a management server which has password-less ssh access to four other servers. I don't have physical access to these servers. In other words, I have to make all ...
1
vote
2answers
129 views

How can I comment out snmpmibd and snmpd in rc.tcpip in AIX using sed?

I need to comment out an entry in rc.tcpip file inside /etc # Start up the snmpmibd daemon start /usr/sbin/snmpmibd "$src_running" # Start up the Simple Network Management Protocol (SNMP) ...
0
votes
2answers
62 views

Use xdotool in a telnet session

I have to simulate key presses in a telnet session, and everything has to be invoked by a shell script. #!/bin/sh telnet 192.168.1.14 50000 xdotool type "404" However, once the telnet session ...
1
vote
2answers
137 views

How can I format a flat file using awk?

Below is the format of some table data contained within a single file: ;NULL;ABCD;ABHJARS;;ABCD;ABCD;Y;;;;;;;;;A; ;NULL;XEU-ANKD;XEU-AJKD;;ABCD;ABCD;Y;;;;;;;;;A; . . ;11744;AMKDIONSKH;AMKDJ AN DJ ...
1
vote
1answer
746 views

Using EXIFTool to add EXIF data from filenames

There is a set of photos with timestamps in their filenames like these: Photo on 3-09-12 at 9.24 PM #2.jpg Photo on 3-09-12 at 9.24 PM #1.jpg Photo on 3-09-12 at 8.23 PM.jpg etc. ("3-09-12", ...
1
vote
1answer
539 views

Create a iptables rule if the rule does not all ready exist

Hi I've created a script to setup Nagios on my remote servers. My Script checks iptables to see if a firewall rule all ready exists and then is supposed to add the rule if it's not all ready there. ...
2
votes
3answers
246 views

Remove spaces and headers from a dumped database table

I have dumped the database table data into a flat file and below is how the data looks like : (Kindly copy from below ;metier_code ; ;-------------------------; (0 rows affected) ...
1
vote
1answer
231 views

What does “if [ -e $name ]” mean? Where $name is a path to a directory

In the if [ -e $name ], what condition check is -e? $name is a variable of a path to a directory.
1
vote
1answer
35 views

Limiting readers on a pipe

I want to use a pipe to pass some security credential information from "process1" to another script. I only want authorized reader processes to be permitted to read the pipe. I am thinking I will ...
3
votes
3answers
117 views

How can I automatically log in to a list of servers to prevent account lockout?

I have started a new contract, and need to have an active account on almost 200 servers. Security has accounts lock after 30 days of inactivity, as well as if you do not log in within 1 hour of ...
2
votes
1answer
30 views

Script. How to sort and move catalogs

I have some trouble writing a script. I don't know how to sort and move catalogs. #!/bin/bash while read -r line; do mkdir "sd/$line" done < 1a.txt After reading information from 1a.txt ...
4
votes
3answers
133 views

Generating diagrams (in PNG or JPG) from console?

From these data I can create a diagram in OpenOffice: $ cat time.log 2014-04-29 08:15:34 1.00 2014-04-29 08:15:36 1.00 2014-04-29 08:15:42 1.50 2014-04-29 08:15:47 2.00 2014-04-29 08:15:55 2.00 ...
1
vote
1answer
209 views

bash scripts - remove duplicate rows with smaller value

Here is an example file: 1 5 20 40 60 2 1 20 20 20 2 2 30 30 30 4 5 40 40 40 7 2 50 30 30 7 1 20 20 20 I would like to remove duplicate rows (with the same value in the first column) with a bigger ...
2
votes
2answers
68 views

How to format textutil -excludedelements

I use Geektool on the Mac to display various information on my desktop. One feature of Geektoool is the ability to use shell mode to launch custom scripts or commands. I am not versed in any type of ...
0
votes
2answers
494 views

Change motd value in UNIX Operating System

I need to change the value of MOTD using a script but I do not know how I should start. Am attaching sample MOTD if anyone can help.             ...
1
vote
1answer
48 views

How to add a dot to particular lines in LaTeX-document?

I have a LaTeX-document where I have lines of the form \section*{3.1} \addcontentsline{toc}{section}{3.1} or in general \section*{x.y} \addcontentsline{toc}{section}{x.y} for x between 1 and 31 ...
1
vote
1answer
131 views

Script or command to replace default parameters in /etc/user on AIX

I wanted to change the parameters settings in /etc/security/user file in AIX OS using a script. This is the sample user file. default: admin = false login = true su = ...
0
votes
2answers
60 views

Different forms of executing a shell script

There are a few similar questions around that I've already seen, but I've come up with something different. I'm reading this http://www.tldp.org/LDP/abs/html/invoking.html and I got confused when I ...
2
votes
1answer
164 views

How to make a bash script wait till a pendrive is mounted?

I have a bash script which has a line cd /run/media/Username/121C-E137/ this script is triggered as soon as the pen-drive is recognized by the CPU but this line should be executed only after the ...
-2
votes
1answer
90 views

Comment multiple line using SED

Seeking help how can i comment multiple lines using SED, i like to comment ftp, telnet, shell, time, ntalk, daytime in inetd.conf file. Thanks in advance
-2
votes
1answer
24 views

I want a script to do following simple task?

My input is : a a l a c g b c ... and so on rando alphabets. A command or a awk statement which will give me: a-1 1-2 l-1 a-3 c-1 g-1 b-1 c-2 basically counter for all alphabets and ...
5
votes
1answer
447 views

Save password in bash script for multiple queries

I would like to know if there is a safe way to only be queried for a password once in a custom bash script, and then save it somehow to be used for later needs. At the end of the script it should be ...
2
votes
1answer
55 views

I'm trying to count and print song file names using awk as following

RANK NAME BAND YEAR GENERE DOMESTIC/INTERNATIONAL 206:Reach Out, I'll Be There:The Four Tops:1978:Pop:3/2 207:Bye Bye Love:The Everly Brothers:1950:Classic:3/2 ...
2
votes
2answers
47 views

Capture transcript of program with redirected input and output

A typical interaction for a program I've written might look like this: Enter command: a_command Completed a command Enter command: another_command Completed another command I typically run my ...
2
votes
1answer
57 views

Switching between 2 windows on Linux

Hi I need to switch focus between two windows periodically and automatically (with software or w/e). Can this be achieved on linux?
1
vote
1answer
43 views

linux if else fails for some IP's

i am using the following code with if then to mount. It works for some IP's, it does not work for some IP's especially for FAILURE statement. Here is the code is_mounted() { mount | grep -qohw ...
4
votes
2answers
4k views

Shell script wait for background command

I am writing a script, but there is something I need that I can't find a way to do it... I need to make a command in background "command1 &" and then somewhere in the script I need to wait for it ...
4
votes
2answers
189 views

Faster way to rename duplicate files (identified by fdupes) in another directory?

I have a directory full of pdf files of journal articles, most of which are named by their bibtex key. Some time ago I made a backup on an external hard drive, but I haven't kept it up to date and ...
0
votes
2answers
55 views

Is it possible to cache external binary in a shell script?

My question, might sounds a bit strange, but this morning I read this question: Why is “echo” so much faster than “touch”? I perfectly understand the concept of built-in function, but I wonder if you ...
3
votes
2answers
200 views

Does cron know that the instance to be scheduled is already running?

I was wondering if we add a job in the crontab e.g. to run every 5 mins and the job does not actually manage to finish in 5 mins, does the cron daemon know that the previous instance is already ...
3
votes
0answers
35 views

Control browser from command line [duplicate]

I have an old router that I have set up as an AP on my home network. For some reason it loses connectivity every few days and needs a reboot. I would like to set up a script to run once every night ...
-2
votes
2answers
57 views

How to delete a directory from terminal?

I'm trying to delete a directory after a series of events take place. That being said, I need to be able to place this in a file to execute once said events take place.
0
votes
1answer
53 views

Script: Running a second process when the firts ended

I am trying to make a script that consist in a two parts. the first one is to run a initial state and the second one is to equilibrating the system. The problem is that the second is dependent of the ...
0
votes
2answers
151 views

Scripting Language Evolution [closed]

I have an assignment due Monday and I need some help because I have no knowledge on the subject and can't even understand what to search exactly. I am not waiting for an essay or something just some ...
2
votes
7answers
1k views

Sort the files in the directory recursively based on last modified date

Sort the files in the directory recursively based on last modified date I have modified a lot of files in my directory want to know what are those files by sorting them by the last modified date ...
5
votes
3answers
312 views

How to rescale several images to same size

I have several image files in a directory. These images are similar size and have same background color. How can I make all images same size by adding background like this attached image?
1
vote
3answers
70 views

awk want to total by hour and variable

I am able to run this and it works fine - note: field $1 is a time/date stamped field.. gawk -F ":" "{ print $1 }" /cygdrive/c/counting/ourlog | sort | uniq -c | sort -r 57339 2014-03-21 09 54290 ...
4
votes
3answers
2k views

Execute a command on user logon

In Linux desktop system, I want to execute a command when the user logs in. After reading some other posts, I tried to insert the command in ~/.bashrc but unsuccessfully. Moreover, the system uses a ...
1
vote
1answer
186 views

Cron task in graphic interface

I need to open one (or more) browser tab periodically and I decided to use cron. The command in the shell (bash) that correctly executes this task is chromium-browser http://mysite.com. If I type it, ...
-1
votes
2answers
133 views

Rename filename.JPG to filename .jpg recursively [duplicate]

Rename filename.JPG to filename .jpg recursively I want all the files with .JPG extension to be changed as .jpg
1
vote
1answer
113 views

how to check if mysql table is used or an application accesses the table in shell script?

A shell script is doing dump for a mysql table, but before dumping the table I want to check if this table is used by any other application. If so, I want to wait and enter in a loop until the ...
2
votes
1answer
50 views

Beginner question about bash “for loop”

When I do, for ((i=0; i<"${ARRAY}"; i+=2)) do echo $i echo ${ARRAY[$i]} done echo $i works as I expected, also echo ${ARRAY[0]} works, but with $i as iterator i see only blank lines. How ...
3
votes
1answer
18k views

Convenient way to check if system is using systemd or sysvinit in BASH? [duplicate]

I am defining common bash files which I want to use across different distributions. I need a way to check if system is using systemd or sysvinit (/etc/init.d/). I need this so I run appropriate ...
4
votes
4answers
647 views

Bash Scripting : Printing column data in the same row

I have written a bash script to calculate the size of a PostgreSQL database and print the output along with the date when the script was executed in a text file. The script code is as follows: ...