A shell script is a script written for the shell, or command line interpreter, of an operating system.

learn more… | top users | synonyms (1)

1
vote
1answer
24 views

Windows command-line: Fastest way to disable internet (keeping LAN)?

Split question: this other one here is for Linux. I think the easiest way to deactivate internet (not LAN) in Windows command-line is to remove the default gateway, so, assuming LAN is ...
0
votes
2answers
29 views

Inserting a linebreak in lines starting with a pattern

I have a huge file that has the following format: #pair: 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 ...
0
votes
1answer
19 views

Shell script not running with cronjob

I am using PUTTY to reach the server. I can dump the databases with the following command: /usr/bin/mysqldump --all-databases | /bin/gzip > Backup_DB/alldatabases_test.sql.gz When I am running ...
0
votes
1answer
16 views

running for loop - but wait for string of words in log file to continue

so far I have this: for each in {01..10} ; do ./sb0$each/tomcat_sb0$each start;done that will start my apps at once, but I want it to wait until it reads one line in a file, what's the easiest way ...
1
vote
2answers
46 views

Monitoring Excessive User Home Directory Growth

I am trying to write a script for a school assignment that will check and see if any of the non-administrative user home directories have increased in size by more than 100 MB in a single 20 minute ...
0
votes
1answer
47 views

Cannot unzip with zip command line

I am having difficult unpacking a zip to a specific directory. I am trying to get all contents of subdirectory of the zipped file and not the parent directory. This is parent directory within zip ...
0
votes
1answer
25 views

Unix Scipt Shell: alert on change of specific files

Could any one Help me with the script Im trying to make a script shell that will alerts/email the root if any of those files has been modified and the script has to auto routine , so the script have ...
0
votes
1answer
10 views

alias can't find a file that actually exists

On my personnal computer, not a server, in my .bash_profile (I'm on OSX) — sym-linked to .bashrc, I have the following line among some others : alias deploy=sh ~/dir/ectory/deploy.sh The file ...
-1
votes
1answer
24 views

how to run a shell script on git commit

1) i have a shell script which basically contains some(database testing and integrating test code) , but i have to run this shell script when ever there is commit (or any change ) in my git repo the ...
1
vote
1answer
22 views

How do I identify shell script execution vs dot execution

I'm writing a bash script that needs to run on the current process for it to be useful. That is, I want to make sure that the script was invoked with source script.sh or . ./script.sh and not ...
0
votes
0answers
20 views

How to find the currently running app from terminal on OS X?

I'm writing a shell script runs in the background and monitors user activity. I'd like to be able to capture current application/document if possible. How can I do that?
0
votes
0answers
25 views

Tools to create a 'GitHub' style index page for files/folder on a fileserver?

My workplace doesn't have a document management system. People just throw files on a shared fileserver, where search doesn't really work. Trying to find information/files for a particular project by ...
1
vote
1answer
49 views

I want to read a value from a text file and compare it with a number

I am using windows powershell. I want to retrieve a number which is stored in a text file and compare it with some other number using a shell script. If I use $x=$(cat value.txt) it says "command not ...
2
votes
1answer
21 views

Loop thru tar file and run commands on each file

I have a process of extracting new code to my servers where the code is packaged in a tar file. Each file referenced in the tar is backed up to a specific directory. I'd like to automate this process ...
0
votes
0answers
13 views

(MAC) Change location of shell script's shell

When I make an executable shell script ("http://chimpy.wordpress.com/2010/08/29/mac-os-x-shortcut-link-to-python-script/", but without the python part), It's pointer location (The location commands ...
0
votes
2answers
30 views

curl shell command always returns error status 0 - even when fails on input errors

Example: trying to upload a non existing file - curl -d @no-real-file http://google.com | echo $? - returns 0. How can I make curl fail on input errors?
1
vote
1answer
39 views

what does =~ in linux means used in if condition to compare values

Actually tomcat/conf/catalina.properties file contains line shared.loader=/usr/share/sfit/conf I mean value has some path. so using shell script we are updating shared.loader values in file. And also ...
0
votes
2answers
25 views

I want to find out word which ends with ()…Use grep

I want to find out word which ends with ()...Using the grep command in linux. grep file_name_where_i_want_to_search "*()" some thing like that....but its not working
1
vote
1answer
84 views

Using wildcards in scp command

I have a bash script which copies several files to a remote server using scp. This script works fine but now I need to add a file that contains a wildcard in the name and i have a problem with it. ...
0
votes
0answers
18 views

Start program from shellscript in background then bring back to foreground later

I'm trying to make a shell script that does the following: Start program ~/x While x is running execute some commands, for example: echo "blabla" >> ~/blabla.txt After the execution of those ...
3
votes
1answer
39 views

Greatest number in a column using shell script

I have a file that contains some data in column format, for example: 219m 219m 3.9g 3.9g 4.0g 4.0g 4.1g 4.1g 4.2g 4.2g 4.2g I want to compare the data and find the greatest value of these. Here g ...
1
vote
2answers
176 views

How to create multiple folders and name them by reading lines from text file?

I have a plain text file named Export.txt. It contains a list of geographical places, preceeded by a 3 digit number with leading zeros. Example --START OF FILE-- 001 Aberdeen 002 Bellevue 003 Camas ...
0
votes
0answers
15 views

Scriptable resize (enlargement) of partition inside LV to end of LV?

I'm trying to automate some KVM installs, and I need to fit an existing image onto a newly created LV. The image is partitioned minimally, so I need a way to enlarge the first partition from the ...
1
vote
1answer
21 views

How to get the path of the newest file among the set of files which contains the same ID?

I want to write a script which will take the ID as an input from the user. Based on that input it will search the directories to match a file which contains the given id. Now, the directory has more ...
0
votes
1answer
39 views

Bash single quotes in find command

I'm having some troubles getting a shell script to work. I'm trying to dynamically generate the find command based on user input and I'm running into the problem that my variables in the find command ...
0
votes
1answer
59 views

How to replace an exact matching word using gsub

Please see the below script - On this nawk 'NR==FNR { a[$1]=$2 ; next} {for ( i in a) gsub(i,a[i])}1' file.dat 1.txt 1.txt ioiufeioru dfoiduf MO_CIF_INP438 fjkdj MO_CIF_INP dsjhdf BP_LINKED_TETES ...
1
vote
1answer
52 views

Send me email everytime a certain file is accessed from my apache server

I want to have my server send me an email every time someone accesses a PDF file on my webserver. Perhaps: tail -f /var/log/apache.log | grep pdf > ??something?? How would I generate a new ...
0
votes
1answer
148 views

how to shutdown ubuntu server from shell script?

I wrote a simple shell script to shutdown ubuntu server. then created a cron job to execute this script at 23:59 everyday. #!/bin/bash sudo shutdown -h now I got this error message "sudo: no tty ...
3
votes
1answer
219 views

Linux command-line: Fastest way to disable internet (keeping LAN)?

Split question: this other one here is for Windows. Linux: Fastest way to disable internet (keeping LAN) from command line? I think the easiest way to deactivate internet (not LAN) in Linux is ...
0
votes
1answer
43 views

ConEmu - running a script in the startup console

I have a script called todo that echoes a todo list to the terminal. I'd like ConEmu to run this every time it starts (thus, in the starting tab). How do I write a task to make it do that? todo is on ...
-1
votes
1answer
109 views

What's needed to have a shell script run via HTTP Post request?

I was wondering what is needed to trigger a shell script with a HTTP post request. Being in my home wifi I want to call http://ip.of.host/req?run and have a script triggered on my host. I guess I have ...
5
votes
2answers
108 views

Bash: How to list n random number of files (not head or tail)

I have a large directory containing numerous files of similar kind. I have to send few random files for auditing. These files should not be from the top or bottom (eg. not in head or tail). This is ...
2
votes
2answers
93 views

scriptdir=`dirname $0` not working

I am trying to get the directory where my script is in by using: scriptdir=`dirname $0` but this gives me the following error: dirname: invalid option -- 'b' Try `dirname --help' for more ...
1
vote
2answers
20 views

How to interrupt my script?

I use the following script (which I start from at command) as an alarm: #! /bin/sh set -m while true; do paplay /usr/share/sounds/phone.wav done & I want to bind a key to stop this alarm. Please ...
1
vote
2answers
297 views

Shell script bash: Moving file iterate based on month

I have very little knowledge about shell scripts, but unfortunately I have to write one. I want to ask about bash script iteration moving files, I need to move log files sorted by month which will be ...
2
votes
1answer
167 views

Bash script gives “command not found” error on if elif statements

Now before you flag this as a duplicate please understand i did search for this problem and i already tried all of the solutions to no effect. My script: #!/bin/bash echo "Enter the number 3" read ...
3
votes
2answers
218 views

Bash script to run “pecl install oci8”

I am trying to create shell script that will do the initial provisioning of a vagrant vm (running Ubuntu 12.04). Everything (installing php, apache, oracle instantclient, etc,) works fine, except for ...
1
vote
1answer
112 views

Unable to run shel scrip file, permission denied

I am having shell script file, basically a setup file for installing xilinx tools. The name of the file is xsetup Also i checked its permission after doing this chmod 777 xsetup In fact the ...
0
votes
1answer
70 views

Cron unable to run shell script

I have been trying to get a shell script to run for hours using cron to no avail. I am trying to have the following bash script run every minute #!/bin/bash ...
0
votes
0answers
32 views

Implement Roll-backing in bash script

I have implemented an Ubuntu package in which bash scripts are using. I followed these for making packages in Ubuntu. ...
0
votes
1answer
43 views

Retrival of read names from fastq file for a particular seq

I have a fastq file.The reads are of length 75bp. This is how a fastq file looks like @ERR030899.2391 HWI-BRUNOP16X_0001:4:1:16426:3738#0/1 ...
-1
votes
2answers
51 views

how to find number of substrings between delimiter? [closed]

I have the string following something(1)^^^something(2)^^^something(3)^^^ ... ^^^something(n) how to find number of something(s) in the string.
1
vote
1answer
145 views

Ubuntu start Node.js server and open Chrome in kiosk mode

I'd like for a computer to immediately start a Node.js application on boot. I'd then like Chrome to open in Kiosk mode, but only after the server has been started. Looking on the Ubuntu Stack ...
0
votes
1answer
112 views

What can I do about “cannot execute binary file”

I have a little shell script that simply starts up a Java program. It is installed somewhere deep in the hierarchy, so I don't want to add its containing folder too my path. So I put a symbolic link ...
2
votes
4answers
101 views

Add a display to let user wait in bash

I am looking for a pretty stupid piece of code for bash that will show a kind of "please wait" rolling display, with the characters : - \ | / The first problem is that I don't know the name of this ...
1
vote
0answers
35 views

Is there any way to see make file with all variables substituted

I have huge long makefile written by some other guy, where all coomands contain variables. In order to decode what this command is doing i have look around what that variable is and its taking too ...
0
votes
1answer
63 views

Eject all disks and dmg's with Automator script in Mac OS X

I have created an Automator Service to eject all disks in Mac OS X. find /dev -name "disk[1-9]" -exec diskutil eject {} \; This works, but I still receive an error message afterwords: "The action ...
1
vote
3answers
36 views

changing order of files

I have a series of files named in alphabetical order (xaa.tif to xdg.tif). I need to reverse the order of the filenames so that the last file is processed first in a script. I would like to rename ...
1
vote
1answer
89 views

How to rename a movie file and also files ins subdirectories (e.g. subtitles) beginning with same prefix

I've several directories with movie files , and also subdirectories with subtitles files with same prefix or starting with same prefix. I want to rename subtitles files with the Directory name it is ...
0
votes
5answers
118 views

How to test if a variable is equal to a number in shell

I have this shell script that isn't working. Input: Server_Name=1 if [ $Server_Name=1 ]; then echo Server Name is 1 else echo Server Name is not 1 fi Output: Server Name is 1 But, if i ...