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

learn more… | top users | synonyms (1)

0
votes
2answers
210 views

crontab not working properly

When I run a script manually using root it is working fine. when I execute the same script inside cron it is not running. I checked the cron is actually calling the script but the script is not ...
0
votes
2answers
654 views

running script containing sudo in cron

#!/bin/bash value=$(<man.txt) echo "$value" if [ "$value" == "true" ]; then echo "startedif_manthan" ps -ef|grep sym |awk '{ print $2 }'|sudo xargs kill -9; sleep 30; sudo sh ...
0
votes
1answer
21 views

Cannot start a script

#!/bin/bash value=$(<man.txt) echo "$value" if [ "$value" == "true" ]; then echo "startedif_manthan" ps -ef|grep sym |awk '{ print $2 }'|sudo xargs kill -9; sleep 30; sudo sh ...
2
votes
2answers
461 views

Is it possible to have scripts that trigger whenever an IM is received in Microsoft Lync?

I've just upgraded to Lync 2013, and I'm considering using it instead of Pidgin+SIPE. One of Pidgin's many nice features is Growl integration... and I would miss that. There are no Growl plugins for ...
0
votes
0answers
25 views

Different behavior from ubuntu server and ubuntu client on windows

#!/bin/bash # Reading cat /home/radiare/Desktop/first.txt | while read LINE do echo $LINE if [ "$LINE" == "false" ]; then echo "Inside first loop" break fi done echo "second file read started" cat ...
1
vote
2answers
242 views

Can not stat over a file name having space in it

I m very new to shell scripting and writing a script for a project. I am having a problem while doing "stat" on a file name, to check size, which has spaces in it. The problem is that I can not write ...
1
vote
1answer
222 views

How to use 7z with variables inside a linux script?

For example: 7za e -y $file_name -o$dest_directory This works fine, when run directly from command line, but within the script it gives this error: could not find archive (No archive by that ...
0
votes
1answer
254 views

Combining multiple data files with header while also adding a data column

I have multiple tab delimited data files that are separated by month in the format jan06.txt, feb06.txt, ..., dec07.txt. Within each file, it looks something like: Header1 Header2 Header3 ... Data1 ...
1
vote
1answer
117 views

Keeping a Perl script from automatically terminating in terminal

I'm trying to create a shortcut of sorts to a Perl script, by saving a terminal command which launches the script to a .command file. The script is interactive, and allows for the user to interface ...
1
vote
1answer
3k views

How to non-interactively provide password to SCP, rsync FTP, SFTP?

How can I supply a password on the command line or in a script rather than on an interactive prompt? I need to copy files in a script and lets say public key is not copied yet to the target. OS is ...
2
votes
1answer
5k views

How can I compare a variable to a text string, rather than integer, in an if/else statement?

In the process of writing a shell script, I ran into an issue with the following if/else statement that falls somewhere in the middle of the script: if [ $act -eq "add" ] then read - "add or ...
2
votes
2answers
253 views

Bad interpreter error when executing shell script with the correct shebang line

When executing a script from the path (scriptname, rather than "sh scriptname") I receive the following error: -bash: ./gitup: /bin/bash/: bad interpreter: Not a directory All of the other scripts ...
2
votes
1answer
133 views

How do I grant higher privileges to a user in linux (Ubuntu server)?

First off, yes I am root. I have another account setup without shell privileges, and without a home directory (for icecast), that now I want to be able to run a script from that uses private key based ...
1
vote
1answer
630 views

How to accpeting password by shell script

As we know that, password must be inputted while switching user [Username: test, Password: test] [user1@hosts ~] $ su test Password: [test@hosts ~]$ Now I want to create a shell script (example: ...
0
votes
1answer
50 views

Default PYTHONPATH on Mc

I am just getting into Python, and accidentally deleted my default PYTHONPATH. Can someone please tell me what paths are included in a clean Python install? Thanks!
1
vote
0answers
63 views

allowing timeouts for commands that have no timeout option, where `IFS=$'\n'`

In the lines below, which I added to my copy of Apple's sysdiagnose script: wherever a timeout is already scripted, it is effective I must add timeouts in two areas, but I don't know how to do so. ...
0
votes
0answers
78 views

scheduling various things and balancing bandwidth while using torrent and uploading

I have approximately 200 files to be downloaded via BitTorrent, these files can be from 200mb to 4.8 GB on the same time I want to take backup of some already existing pdfs in my home directory, ...
2
votes
2answers
430 views

Bash/expect script to log in via ssh and port knocking. SSH Keys not possible

My login server is behind a firewall that uses port knocking to allow entry. The login-flow is Enter in port knocking command. This requires my external IP to be entered. When prompted, enter in my ...
0
votes
2answers
89 views

For loop with conditions

I have a script that adds user on many server. Since I'm adding on many server(s) I am using for loop. Below are the output when user is successfully added. 0,22529,User added. If the user is not ...
1
vote
3answers
91 views

Find a file in the CWD or any of its parents

I'm trying to create aliases for commands I'm typing a lot. Because I'm working on a big project built on Laravel I need to use the command line tool artisan fairly often. However, I don't often want ...
6
votes
5answers
5k views

How to echo commands in a bash shell script, but not execute them?

Is there a way for running a shell script with echoing the commands but w/o actually executing them? Let's say I have script removing a file whose name is stored in a variable: #!/bin/bash set -v ...
0
votes
0answers
136 views

Workaround for ENOTTY while running a c process from script?

What's the issue? Getting a ENOTTY error on a function call tcgetattr() when the process is invoked from a script. The error comes only when ran from the script. If it is run from an interactive ...
2
votes
4answers
152 views

Parsing command line output delimited by underscore

I've got some command which output looks like that: some_command Current view: username_token1_token2_token3_4_token4_2 How could I parse the "token3_4_token4_2" part out of the string?
1
vote
2answers
1k views

cp into destination hierarchy with symbolic link?

I am trying to write a site deploy script that will copy files like so: SOURCE . .. src/ html/ DEST . .. src/ html/ -> /var/www/ftproot/mysite I want the files in SOURCE html to go to DEST ...
1
vote
1answer
245 views

Where to store cronjob script?

I'd prefer to not keep it in my /home/myusername directory. Is there a best practice of where to store your shell scripts for cronjobs? At the root level? I'm running ubuntu server 12.04 right now.
2
votes
1answer
81 views

How to list all scripts called by a master script?

I want to list all scripts (recursively) which are being called by a master script. For example: master.sh a.sh >> this script calls a1.sh, a2.sh, a3.sh etc b.sh >> this one calls b1.sh, ...
-5
votes
1answer
209 views

How to copy a list of files from one directory to another and modify the destination file name on the fly

Could you propose a way to copy a list of files from one directory to another. During copying the script should capitalize the first letter of the filename and lowercase all other letters.
0
votes
0answers
145 views

rsync shell script

Need some hints on my first shell-script using rsync. I use rsync, because I had some trouble with a graphical Backup that ran twice and now I want this example as shown below to work on two external ...
0
votes
1answer
662 views

executing a shell-script through makefile

i am trying to create a .deb file that first installs the dependency that is stored in the some folder, for that i have created a shell script. My issue is executing the shell script through make file ...
0
votes
1answer
203 views

Identify text/ASCII files in Linux/Solaris

I have a little project to build a bash script that searches the OS (Linux/Solaris) for the current IP address in files, and replaces them with another IP address. The problem is that IP address ...
0
votes
1answer
107 views

for loop non-ending, loop never procedes to second argument

I am trying to use the "for name in" to loop through a list of values. It uses the first value in the line but sticks in a never-ending loop. #!/bin/ksh set -x # created 7 JAn 2013 by L Cooper # ...
1
vote
1answer
339 views

Handling whitespaces in the name of a ZFS dataset in a shell script

I'd like to take output from two commands – zpool list zfs list and for each found pool: zpool get all nameofpool and for each found file system: zfs get all nameoffilesystem Background and ...
0
votes
1answer
244 views

Determining if an argument looks like a valid path

I'm writing a bash script that needs to perform some operation on an argument which is a path The path may or may not correspond to an existing file on the user's system, so I'd like to test whether ...
0
votes
1answer
31 views

Environment auto-install

When I work, I often have to switch computers or virtual machines which means that every time I switch, I have to set up my (Linux) environment again. My question is the following : Is there a tool ...
3
votes
1answer
2k views

How do I close a window from an application, passing the file name?

I’m trying to produce an Applescript-based shell command that tells the Preview application from Mac OS X to close a particular window. #!/bin/sh osascript <<EOF tell application "Preview" ...
7
votes
1answer
314 views

How to change the appearance of empty folders in finder using Automator?

I'm trying to use Apple Automator to label empty folders in a heirarchy. Basically, I start off a project with a heirarchy of empty folders and fill them as I work. I want a workflow to label all ...
1
vote
1answer
161 views

how to remove “downloading” or 0% complete torrents in rtorrent using bash script?

I have 10K torrents and 7K of them are going too slow. I would like to remove them but the rutorrent and rtorrent interface is unusably slow. I noticed that the info about rtorrent is kept in .session ...
0
votes
1answer
160 views

Check file name and filter it based on the date

I have many files one of my scripts generate daily. The file name structure resembles: capacity_data_2012-12-02.txt , capacity_data_2012-12-03.txt and so on... I want to create a script which would ...
0
votes
1answer
2k views

How to append text to a specific lines in a file using shell script?

I have a text file (file.txt) having content something like: foo1 3464 foo2 3696 foo3 4562 It contains the process and respective PID. Using shell script, I want to append a string (running/not ...
3
votes
1answer
405 views

Script-specific autocomplete in shell

I create a lot of little scripts to help me in my every day life. I would like to provide auto-complete for them, specially that I intend to share them with people. Now, I know I can create ...
-1
votes
2answers
1k views

Execute multiple commands in one line inside unix shellscript

The question is somewhat related to the question asked here, http://stackoverflow.com/questions/5130847/shell-multiple-commands-in-one-line, but the difference is, I need to execute the whole commands ...
3
votes
2answers
363 views

shell script - How to output the owner of a file

Is there a command to output the owner of a file, and nothing else? I suppose I could use ls and run it through sed, but if there is a better way, I would definitely use it. Thanks in advance.
3
votes
2answers
2k views

How to add commands of windows to local shell of XShell 4

XShell is a very powerful tools to ssh remote computers such as Unix/Linux. And it has built some internal commands for you to run within your Windows. Xshell:\> help Internal Commands: new: ...
1
vote
1answer
106 views

Hard linking directory structure somewhere else

I have one directory where files appear in. I want to run a script regulary that finds all files in that directory that have only one link to them, and hard link them in another directory. However, I ...
0
votes
1answer
428 views

Can setting the executable flag on an installation script lead to CRC check failure?

Recenty I have installed the VMWare Workstation for Linux on my Ubuntu machine and in the process of installation I have ran into a peculiar problem. The installer itself is some kind of archive that ...
0
votes
1answer
54 views

Excute for loop in subfolder

I have this command : for i in $(svn st | grep \! | awk '{print $2}'); do svn delete $i; done I would like to execute it to a subfolder without making a cd command. Is it possible ? Thanks !
3
votes
3answers
775 views

How to auto source a shell script?

How to make a shell script execute it's commands as source commands without having to use "source scriptname.sh" expression to launch the script? Basically what I want is to type ./scriptname.sh and ...
0
votes
1answer
472 views

How do I view the OS installation date on Solaris 10?

How can I find out the system installation date on Solaris? Objective is to verify the date and time that the OS was created (OS creation timestamp).
0
votes
2answers
153 views

How to start a local server and open it in a browser from a shell script

I have a test suite which runs in a browser (using QUnit, though that's unimportant). The test suite requires a local server running on a particular port. Running the tests currently involves a few ...
2
votes
2answers
2k views

Automatically mounting Truecrypt volumes at user login time

I need to mount a Truecrypt volume automatically at user login time. This volume is specific for each user. I'm not sure how to proceed since I'm not extremely familiar with Linux and the various ...