Questions tagged [shell-script]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
621 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 ...
user1597811's user avatar
0 votes
2 answers
4k 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 /...
user1597811's user avatar
0 votes
1 answer
48 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 /...
user1597811's user avatar
3 votes
2 answers
2k 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 ...
John O's user avatar
  • 755
0 votes
0 answers
30 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 ...
user1597811's user avatar
2 votes
3 answers
3k 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 ...
Anil Bhargava's user avatar
1 vote
1 answer
2k 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 ...
Bhavya Maheshwari's user avatar
0 votes
1 answer
907 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 ...
user1027169's user avatar
1 vote
1 answer
218 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 ...
Jules's user avatar
  • 698
1 vote
1 answer
11k 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 ...
user193154's user avatar
40 votes
2 answers
131k 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 ...
tony_perkis666's user avatar
4 votes
2 answers
7k 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 ...
tony_perkis666's user avatar
2 votes
1 answer
403 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 ...
UserZer0's user avatar
  • 632
1 vote
1 answer
2k 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: ...
Marslo's user avatar
  • 1,161
0 votes
1 answer
203 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!
Thomas's user avatar
  • 247
1 vote
0 answers
151 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. ...
Graham Perrin's user avatar
0 votes
0 answers
98 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, ...
Registered User's user avatar
2 votes
2 answers
2k 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 ...
Zach Melnick's user avatar
1 vote
2 answers
150 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 ...
maneeshshetty's user avatar
1 vote
3 answers
316 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 ...
Robert K's user avatar
  • 113
16 votes
7 answers
37k 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 FN=...
ysap's user avatar
  • 2,670
1 vote
0 answers
442 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 shell,...
Mohit's user avatar
  • 111
2 votes
4 answers
771 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?
Artem's user avatar
  • 135
5 votes
2 answers
8k 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 /...
est's user avatar
  • 654
29 votes
2 answers
24k 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.
tarabyte's user avatar
  • 2,323
2 votes
1 answer
269 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, ...
Pandoo's user avatar
  • 23
-4 votes
1 answer
400 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.
Rahul's user avatar
  • 11
1 vote
1 answer
5k 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 ...
Shurmajee's user avatar
  • 458
0 votes
1 answer
639 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 ...
yael's user avatar
  • 27
0 votes
1 answer
156 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 # ...
Lee Cooper's user avatar
1 vote
1 answer
2k 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 ...
Graham Perrin's user avatar
0 votes
1 answer
3k 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 ...
tgies's user avatar
  • 1,133
0 votes
1 answer
47 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 (...
Awake Zoldiek's user avatar
10 votes
2 answers
24k 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" ...
Ewan Delanoy's user avatar
7 votes
1 answer
571 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 ...
Gary's user avatar
  • 71
2 votes
1 answer
646 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 ...
kirill_igum's user avatar
  • 1,318
0 votes
1 answer
1k 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 ...
maneeshshetty's user avatar
0 votes
1 answer
6k 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 ...
smya.dsh's user avatar
  • 103
4 votes
1 answer
3k 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 auto-...
Xananax's user avatar
  • 205
-1 votes
2 answers
4k views

Execute multiple commands in one line inside unix shellscript

The question is somewhat related to the question asked here, https://stackoverflow.com/questions/5130847/shell-multiple-commands-in-one-line, but the difference is, I need to execute the whole ...
Jimson James's user avatar
3 votes
2 answers
2k 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.
BenjiWiebe's user avatar
  • 9,035
4 votes
2 answers
13k 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: ...
dylanninin's user avatar
4 votes
2 answers
1k 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 ...
Tom Ribbens's user avatar
0 votes
1 answer
519 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 ...
Igor Zinov'yev's user avatar
0 votes
1 answer
73 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 !
Pierre's user avatar
  • 317
3 votes
3 answers
4k 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 ...
Andrew-George Hondrari's user avatar
0 votes
1 answer
4k 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).
yael's user avatar
  • 27
1 vote
2 answers
5k 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 ...
davidchambers's user avatar
2 votes
2 answers
3k 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 ...
Martin Frank's user avatar
4 votes
0 answers
540 views

Run program on kde logout

I have created a backup script and I want to run it in a terminal window (to view the progress) when I logout from kde. I used the autostart feature and that works but I'm unable to show a terminal ...
vdrmrt's user avatar
  • 141

1
20 21
22
23 24
29