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

learn more… | top users | synonyms (1)

3
votes
2answers
141 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
251 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: ...
0
votes
0answers
50 views

automatic set up at linux with shell scripts

I have a new installed linux-system and I would like to write some scripts for the basic installations. The aim is to be able to repeat this installations whenever i need them without losing time. ...
1
vote
1answer
56 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
303 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 ...
2
votes
3answers
217 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
74 views

How do I view the OS installation date on solaris 10

Please advise on how I can find out system installation date on SOLARIS, Objective - verify the date and time that OS was created ( OS creation DATE - stamp ) thx yael
0
votes
2answers
59 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
365 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 ...
1
vote
0answers
72 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 ...
0
votes
1answer
148 views

Make shell script commands to abort after certain timeout

I have often a situation in Linux shell scripts that if a specific command takes too long to run e.g. due to a network problem the shell script should abort running this command. What best practices ...
0
votes
1answer
39 views

Documenting software-updates semi-automatically in MacOS X by parsing log files?

I'd like to document changes I made to my computer (running MacOS 10.6.8) to be able to identify the sources of eventual problems. Mostly I install updates when a software notifies me about a newer ...
0
votes
1answer
113 views

How do I create a “here document” within a shell function?

I'm working my way through William Shotts Jr.'s great The Linux Command Line on my Mac OSX 10.7.5 system. 90% of the linux that Shotts covers is close enough to Darwin that I can figure out or GTEM to ...
0
votes
2answers
100 views

Shell script: Copy folder with a new name

I'm trying to write this shell script to create in the parent directory a copy of the folders found in the current directory. So far, I wrote this: for folder in *; do mkdir ../$folder; done ...
1
vote
0answers
33 views

How to put a Number in to a plist with bash

I'm trying to update my com.apple.background.plist. It works but the "ChangeTime" needs to be a Number/Integer in order to work. I tried to place a -int into the code but it gives an error. ...
3
votes
2answers
199 views

When default shell is not bash-compatible, why do bash scripts not work well?

My default shell is fish, because it's a lot nicer. But often when I run scripts, I get errors that seem to be from the bash script being processed by fish. I think this is because the script writer ...
0
votes
2answers
413 views

Automounting SD card when inserted in Ubuntu

I am trying to write a BASH script that automounts an SD card once it is inserted in the card reader, then move all pictures to a folder in the HDD and renaming each file to the date and time the ...
0
votes
1answer
159 views

Unix shell script - cp -R doesn't copy contents behind symbolic links

I've got this ./image folder full of symbolic links to "real" folders. These "real" folder contain a series of images. ./image/stones -> somefolder/stones ./images/grass -> ...
0
votes
1answer
124 views

update terminal title from standard output of long running command?

I'd like to change the title of a terminal window during a long running command (for example: git svn fetch) with values greped from the output, whilst still writing to standard output. Is this ...
1
vote
1answer
616 views

How to execute multiple scripts when openvpn establishes?

I am using ubuntu 12.04 to connect an openvpn server. Two scripts update-resolv-conf and vpn-up.sh in /etc/openvpn should be executed then the connection established. The commands following added to ...
0
votes
3answers
324 views

Need help creating a batch file to replace “.” with “-”

Like the title says, I need help creating a batch file to replace "." with "-", however I need to perserve the file extensions and it needs to work through the subfolders. I found another post on here ...
2
votes
2answers
134 views

Problems with Startup after Script runs to Shutdown Windows 7 PC

I have a simple .bat script to shutdown a kiosk style machine in our work shutdown -h -f this hibernates the machine and I have it running each evening as a scheduled job. However my problem comes ...
4
votes
2answers
419 views

Writing shell scripts that will run on any shell (using multiple shebang lines?)

I've just started getting deeper into shell scripting, and I've always just thrown my script in a file, marked it chmod +x and then done /path/to/script.sh and let whatever interpreter is the default ...
0
votes
1answer
352 views

Open a terminal window & run command, then close the terminal window if command completed successfully?

I'm trying to write a script to do the following: Open a terminal window which runs a long running command (Ideally) move the terminal window to the top left corner of the screen using xdotool Close ...
1
vote
1answer
251 views

BASH script not working on windows

So I made a bash script, that works on MAC perfect, but on windows even with cygwin and CURL installed doesn't work, here is the errors that I'm getting $ ./r.bash Project name: imiodrag ': not a ...
2
votes
1answer
149 views

Passing Return Key via Shell Script

I'm using phpseclib to run a shell script on my server at a given interval. That script involves using nohup. For whatever reason, if there isn't a user ready to send SIGINT or a return to nohup once ...
2
votes
1answer
249 views

How can I tell if the lock screen is active from the command line on OS X?

I have a cron script that I want to run regularly if I am logged into my Mac. I don't want it to run if the Lock Screen is up. Is there a way to check from the command line / Terminal if the Lock ...
4
votes
2answers
136 views

Efficient way to use all cores in bash or zsh script

If I want to process large number of files with command "do_something" which only can use one core, what's the best way to use all available cores assuming each file can be processed independently? ...
1
vote
2answers
74 views

Arguments passed on by shell to command in Unix

I've been going over this question and I can't for the life of me figure out why the answer is what it is. How many arguments are passed to the command by the shell on this command line:<pig pig ...
0
votes
0answers
73 views

PBS/Torque: very simple pbsdsh script with PBS_VNODENUM

I'm trying to submit the following very simple script to my cluster: #!/bin/sh #PBS -l nodes=3:ppn=8,walltime=00:01:00 #PBS -M eamorr@mydomain.com #PBS -j oe #PBS -m bae #PBS -N geophysics pbsdsh ...
1
vote
2answers
80 views

How do I delete a directory from Terminal without knowing its name?

I have a directory which I want to delete. The directory's name is a random string of letters and numbers. I know the path to its parents directory, so how would I recursively delete the contents of ...
0
votes
2answers
1k views

While loop until a file exists in bash

I want to write wait until a file exists in bash. How do I do this? I tried this but it doesnt work: while [ ! -f outputs\/$trace\_hist_len_$hist_len\_page_size_$page_size\.out]; do echo "waiting ...
1
vote
0answers
30 views

Scripting the way firefox starts

In Windows 7, is there any way to script the websites that are opened whenever I open Firefox based on certain criteria? For example, if it's Thursday, load a certain website as my homepage, but only ...
1
vote
1answer
76 views

Why aren't my if statements going through?

I am creating a bash script that is suppose to copy all files in ~/Development/ to another computer on my network. I have enabled it to mount the computer if it is not there, but my real problem is ...
1
vote
3answers
168 views

Batch combine two files in Unix

Does anyone know how to batch prepend one audio file to another audio file and create a separate output for each. E.g. Files: Static.wav Audio1.wav Audio2.wav Audio3.wav I need a script that can ...
0
votes
1answer
269 views

Advanced merge directory tree with cp in Linux

I need to: Copy all of a tree's folders (with all files, including hidden) under /sourcefolder/* preserving user privileges to /destfolder/ If there is a conflict with a file (a file with the same ...
1
vote
1answer
465 views

Reading values from plist nested dictionaries in shell script

I have a plist file and I'm interested in fetching values from nested dictionaries using shell script. Here is the structure of my plist file: <dict> <key>Countries</key> ...
0
votes
1answer
91 views

Discrepancy in file size on disk and ls output

I have a script that checks for gzipped file sizes greater than 1MB and outputs files along with their sizes as a report. This is the code: myReport=`ls -ltrh "$somePath" | egrep '\.gz$' | awk ...
2
votes
1answer
55 views

'action' command in shell scripting

Look at the following lines of code: . $IPKG_INSTROOT/etc/functions.sh initscript=$1 action=${2:-help} shift 2 What does the action command do?
1
vote
3answers
1k views

Run shell script on windows using Cygwin

I am having trouble with running .sh script on Windows using Cygwin. When i run the file: ./build.sh -s srv.txt I am getting: ./build.sh: line 1: #!/bin/bash: No such file or directory Can you guys ...
0
votes
1answer
249 views

My bash script does not find an existing file (into the script's wd) which name I passed as a parameter in a function

I realized a bash script that works on an existing text file located into the same working directory of the script. The script take name of the file to compute through a function parameter. The issue ...
10
votes
3answers
736 views

Escaping apostrophe in single quotes string in bash

I don't understand how Bash evaluates escaping of apostrophe characters in single quoted strings. $ echo ''\''Hello World'\''' 'Hello World' #works $ echo '\'Hello World\'' > # expects you to ...
0
votes
1answer
190 views

cp: fts_open: No such file or directory error

I have this script: #!/bin/sh -x /bin/echo "Drag folder into Terminal and hit return ->" /usr/bin/read folderLocation /bin/cp -R "$folderLocation" /Users/my/Desktop/ And it ...
2
votes
1answer
196 views

Applescript Woefully Slow Finder.app Set Comment

This is the script: set d to do shell script "date +%d-%m-%Y" tell application "Finder" set dir to POSIX file ("/Volumes/Xsan/PathTo/Folder") as alias repeat with f in entire contents of ...
1
vote
1answer
292 views

How to get the CPU and memory usage per session Linux

I have to do a script in bash to calculate the percentage of CPU and memory usage per session in Linux. What standard UNIX tools can I use in my script to get this information? I have this ...
3
votes
1answer
610 views

How do I parse file paths separated by a space in a string?

Background: I am working in Automator on a wrapper to a command line utility. I need a way to separate an arbitrary number of file paths delimited by a single space from a single string, so that I may ...
1
vote
0answers
53 views

Unable to connect to Amazon EC2 without using PPK file

I have a build job which runs on Hudson and synchronizes content from an Amazon AWS server. This is written in shell I have a PPK file given to me which can establish the connectivity Here is the ...
0
votes
1answer
46 views

zsh expansion modifiers in scripts

I've just found out that ZSH's modifiers only work in interactive scripts, so the following will work correctly on the command line but not from a script (the script ignores the modifier and echoes ...
0
votes
1answer
78 views

Bash delete file when variable = x

I'm creating a bash script which reboots the system at each reboot it adds a new line to a text file, I then read the text file before each reboot. Once the variable holding the number of lines ...
2
votes
1answer
58 views

Automating the installation using SSH

I am running a bash script from a remote host to run a binary file which installs 64 bit JDK 6 update 29 on multiple VMs across the Environment. It is installing the file but, at the last line i have ...

1 2 3 4 5 10