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)

2
votes
0answers
10 views

Catch a console shutdown signal on Fedora 19

I need to catch any OS shut down and execute some actions before letting the OS be shutted down. I'm using Fedora 19 and C++. I'm able to catch a shutdown signal given by the console with the ...
0
votes
2answers
45 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
41 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
0
votes
0answers
32 views

Java auto updater & bin bash scripting [on hold]

I'm rather new to shell scripting, and I've created a small semi-automated Java updater script. #!/bin/bash response=$(wget --spider -S --no-check-certificate --no-cookies --header "Cookie: ...
0
votes
0answers
50 views

Question. How to write a Shell script? [on hold]

I need to write a script which could read information from txt file. In that txt file should be 3 words. When Script has to make 3 different directories with those words and two of them should be ...
-2
votes
1answer
20 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
52 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
34 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
18 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
32 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
votes
0answers
24 views

fetching the username from the filename in batch script [closed]

I need help in fetching the username present in the filename using batch scripting. Say i have a file ppm_update_user1.csv. I need to get "user1" value from the filename. The above coding has to be ...
1
vote
1answer
33 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 ...
3
votes
2answers
157 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
36 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
48 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
94 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
33 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
51 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
41 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
88 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
74 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
261 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
52 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
194 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
39 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
39 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
0
votes
0answers
15 views

I want to execute a shell script on an Android device when it boots up [migrated]

I want to run a shell script on my Android device every time it boots. What do I need to do? The script is stored on the MMC of the device and looks like this: #!/system/bin/sh ...
1
vote
1answer
45 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
41 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 ...
1
vote
1answer
74 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
153 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: ...
3
votes
2answers
40 views

Bash script : help file inside the script or in a different file?

I'm writing a script that has the vocation to be a fully featured program at the end. As far as I know, BASH is enough for his purpose (manage PPA's, kinda like Y-PPA). I would like to know how to ...
1
vote
1answer
26 views

Wait until no incoming network connection for N minutes, then execute a command

I want to put my Debian Wheezy home server to sleep, if it wasn't accessed through the network for a certain amount of time. I thought of a bash script that uses netstat to count the number of ...
1
vote
3answers
124 views

Delete files with same name at the end of the file

Delete files with same name at the end of the file i have a lot of files in my folder and sub directories like ajax_hostel_room_master.php.php class_hostel_registration.php.php ...
1
vote
1answer
46 views

Can Start Service With init.d script, however doing service <SERVICE_NAME> start does not work

I am running CentOS 6 and I am trying to get my Oracle database to run at startup. I have been following these steps: ...
5
votes
1answer
168 views

When is it important to write portable scripts?

Most code I write is in PHP. I have recently started learning shell scripting. Most of the resources and tutorials that I've come across are specific to Bash. Some warn about bashisms and some don't. ...
3
votes
5answers
171 views

How can I force a script to use more resources?

I'm running a very time-consuming script which takes many hours to end. Watching top I see that it's only taking 5% of the CPU at best, usually around 3%. Is there any way to force the script to use ...
1
vote
0answers
34 views

Logging into multiple SSH servers as root and create an user with same power as root does [closed]

I need a script from which I can log into multiple servers as root (but not all root passwords are same;there are 3-4 different root passwords) and make a superuser (user with same access as root) but ...
6
votes
1answer
83 views

A shell-like environment for binary processing

This question came to me a couple of times before, now in response to the question Loop through binary data chunks from stdin in Bash Answers given in ...
0
votes
2answers
29 views

Help With Simple Script - Absolute, Relative Paths

I'm trying to execute a mono application, without requiring the user to type in 'mono filename'. It's just one line of code: mono ./Bin/jobshop.exe $1 $2 $3 $4 $5 $6 $7 $8 $9 It works great, so ...
2
votes
4answers
55 views

Wrapper command that runs program in temporary directory and deletes it after execution [duplicate]

I want to write a command that: takes another command as its arguments does a 'cd' to a temporary folder executes the command passed in the arguments removes the temporary folder afterwards ...
1
vote
1answer
53 views

How do I rename lots of files on a directory without changing their extensions? [duplicate]

I have a problem! I have a bunch of image files with extensions. Jpg and. Png. I wrote a script that renames the files, changing their names in a pattern followed by a number like this: ... ...
2
votes
3answers
93 views

creation of user add

I'm having more then 59 servers I need to create a script for user add. purpose: if I'm creating a user in one server it will be reflected on all 59 servers. How can I accomplish this?
0
votes
0answers
56 views

replacement script multiple targets

I have this input file Name=code_229633_138;isoforms=1 Name=code_229633_138 Name=code_229633_138;Target=R77_09738T0 Name=code_230519_1;isoforms=1 ...
3
votes
3answers
341 views

if/then/else man page

I would like to know if there is any man page documenting the construction of the most basic script commands like if/then/else, while, for each, and all the relative switches, like -eq, -e, -ge, and ...
3
votes
3answers
248 views

How can I extract/parse a complete URL from a semi random string?

I'd like to have bash parse/extract a full URL (and only the url) from a random short string. Examples: bob, the address is http://www.google.com or https://foo.com/category/example.html is up ...
6
votes
2answers
189 views

What's the most efficient way to grep for two completely separate things and assign the values to separate variables?

CentOS 6.x I want to take the output from curl, grep for two completely separate strings, and assign their respective values as variables. What is the most efficient way to do this (without writing ...
20
votes
2answers
534 views

How do I move all files output from a command?

I have this grep command to find files without the word Attachments in them. grep -L -- Attachments * I want to move all the files that are output from that command. How do I do that in bash? Do I ...
1
vote
2answers
121 views

Creating a shell script that parses and redirects number into next command?

I am trying to create a script that kills an Xorg process. Here is an example of me running the commands in a terminal: First, I find the process id of the Xorg program (in this case, 2494): . ...
4
votes
4answers
484 views

Check for Process if Same is Running

Is there a script or a way in linux that when I try to execute a shell script/process, if the same is running, it will prompt that same is running and will exit otherwise it will continue.