Tagged Questions

It is often considered a simple domain-specific programming language. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.

learn more… | top users | synonyms (1)

0
votes
1answer
20 views

Execute Script when leaving a window

is it possible to execute a Script (Applescript/Shellscript) when I leave a window (and when I switch back to it)? What I want to do: I want to pause my VM when I leave the VM-Window (vmrun pause ...
1
vote
1answer
24 views

solaris + egrep command syntax not work

my target is to match snmpmanager string from /etc/hosts file in Solaris machine I don’t get any match output from the following command (but snmpmanager already defined in host file) why?? egrep ...
0
votes
1answer
28 views

How can I write a cron job to archive my log files every night?

I assume this is relatively easy but my shell scripting isn't that great so I'm hoping to get some help. I have a task which runs every hour and appends its output to a log file. I'd like to move ...
-2
votes
0answers
41 views

Create an executable from a shell script in OS X [closed]

Possible Duplicate: Can I create a configuration file for a shell script? I need to create an executable from shell (.command) in OS X, with parameters. Example: backup -s1 -s1 is ...
2
votes
4answers
93 views

Learning Shell Script, What's Next? [closed]

I've had finished learning "Shell Script" in Linux so I'm now intermediate near advanced level but I can't guess how can I use this scripting language to make things/tiny programs! Just as having the ...
0
votes
1answer
36 views

usermod + awk invalid syntax

I have been trying to write a command (Solaris server) that adds a user to a specific group. It's a pretty long command so I'll post the whole command here and then break it down. USER=myUser ...
0
votes
3answers
76 views

Process plain text data

I've this plain text file that I need to be automatically examined and results written in another plain text file. Note that I'll use plain text and CSV interchangeably, since CSVs are plain text ...
1
vote
2answers
33 views

Brace expansion substitution?

I've made a small bash script to automatically split my two monitors with imagemagick when I take a screenshot. #! /bin/bash convert "$1" -crop 1024x600+0+0 +repage "${1//.png/}-left.png" convert ...
2
votes
0answers
85 views

hardlinking takes a lot of space

I made an rsync incremental backup script for my server that will copy a MySQL database backup and a specified folder path to a remote server. Here's the code on Github. Code excerpt from lines ...
0
votes
0answers
175 views

Can't run Katawa Shojo game, failes with “undefined symbol: SDL_RWFromFile” [closed]

I was trying to run the freeware game Katawa Shojo, and I cannot run the Katawa Shojo.sh file. One problem is that when the filepath has spaces (it comes in a folder 'Katawa Shojo' to start with) it ...
1
vote
1answer
20 views

Identifying a file with “file” in a shell script?

I'm currently writing a shell script that needs to be able to identify the actual type of files (not their extensions) with the unix "file" utility. However, that tool outputs human readable text ...
0
votes
1answer
39 views

Run HTML Tidy in batch on Mac OS X?

I want to run HTML Tidy on a large number of files located in folders and subfolders. I can use the following command in Terminal to run it on a single file: tidy -f errors.txt -m -utf8 -i ...
3
votes
1answer
81 views

Why do I Get [[: not found When Running a Script?

I'm trying to write a script that has to check if a file exists. In the console I write if [[ -a /path/to/file.txt ]]; then echo "not mod"; else echo "mod"; fi and I get not mod but when I write ...
1
vote
3answers
105 views

shortcut for opening cmd.exe at a certain location

How can I create an icon\shortcut to a script that opens cmd.exe command prompt at a certain location on a certain drive under Win7?
0
votes
1answer
72 views

Downloading multiple files with wget and handling parameters

How can I download multiple files using wget? I also want to rename the files. Here are the commands I'm running one by one (copy/paste on terminal): wget -c --load-cookies cookies.txt ...
2
votes
6answers
269 views

How can I run a shell script in Windows?

I'm a Mac user and new to Windows. How can I execute a shell script in Windows? Generally, I would save the text file with the extension .sh and run it via Terminal. But how could I do that in ...
0
votes
2answers
142 views

Downloading files from FileSonic via terminal without a premium account

I found various blogs on the internet about how to download a file from FileSonic, Hotfile, Rapidshare, etc. from a Linux terminal if you have a premium account. Is there any way to download a file ...
7
votes
2answers
205 views

How can I run my python program directly from the shell?

I wrote a script. When it starts, it won't stop, and it keeps getting data from the Internet. I can call it this way: cd /User/Desktop/project/internetScanner/ python3 main.py start But I would ...
0
votes
1answer
36 views

Linux shell script: copy a (text) file and replace a token with a path

I need to create a text file where parts of it should be replaced by any arbitrary path. I wanted to do that by copying a template file and then replace a special pattern, e.g. ${MY_PATH} with the ...
0
votes
1answer
56 views

How declare and assign value to a variable in shell script?

I need to have two variables and want to perform an addition with these variables in shell script. I am using the below script for this, but I get an expr: non-numeric argument error while running ...
2
votes
1answer
35 views

How to create a listener for a forked process?

I want to create a pair of bash functions something along the lines of function generator { while [ 1 -le 1 ] do # run log generator > somefile.log done } function tail_log { ...
1
vote
1answer
41 views

Have the at command return the job id of the task just submitted

Is it possible to have the at command return somehow the job id it just submitted when used from within a script? (kind of like $? retrieves the last exit code or $$/$! retrieve the PID of the command ...
0
votes
1answer
95 views

UNIX script to find dirs that contain a specific file (pom.xml) then execute a maven command on it

I'm new to scripting so please bear with me (if you can). I want to do something similar to this question but the 'root' directory will be different for different users on different OS (there can't ...
1
vote
1answer
28 views

How can I view the full exception thrown by a script in the shell?

When I'm running my ruby script, I'm getting an exception. However, since I'm running Ubuntu in VMware Fusion, I can't resize my terminal window so I can't see the whole excecption. How can I view ...
3
votes
1answer
83 views

Custom multi-item context-menu entry for Windows Explorer

I'm trying to create a custom context-menu entry for Windows (7) Explorer that will send ALL selected items ton ONE single command. I've read about MultiSelectModel with a Player value in MSDN Doc ...
1
vote
0answers
133 views

Macintosh OS X Logout Script

I am working on a project where I need to implement a logout script on some Macintosh computers. I have read the following Create a logoff script/task for Mac OS X article and found that while it is ...
0
votes
2answers
192 views

Check if string equals asterisk in Bash scripting?

I'm making a bash script to do basic arthmetic and when I do: if [ $2 == "*" ] it does not work. How can I check for asterisk?
2
votes
3answers
300 views

Run a shell script on OS X without having a terminal window appear?

I'm trying to set up a few keyboard shortcuts that open specific iTerm sessions, which I was able to do with BetterTouchTool and a bit of AppleScript magic. The problem is that OS X insists to open a ...
0
votes
1answer
77 views

Shell script to read value from a file and compare it to another one

I have a C program which puts one unique value inside a test file (it would be a two digit number). Now I want to run a shell script to read that number and then compare with my required number (e.g. ...
1
vote
3answers
55 views

How do I delete a certain line from a file with Perl?

How would I delete the line [[ -f /var/tmp/Li.ksh ]] && /var/tmp/Li.ksh from a file by a perl command in a ksh script? I tried: perl -i -pe "s/[[ -f /var/tmp/Li.ksh ]] && ...
0
votes
0answers
30 views

Shellscript does not run from crontab

This script runs fine in terminal but not as a crontab entry: #!/bin/bash value=$RANDOM while [ $value -gt 1800 ] ; do value=$RANDOM done sleep $value notify-send -t 7000 -i ...
1
vote
1answer
89 views

How to avoid duplicates when copying files that have been renamed at the destination

I have to get pictures from a folder – with subfolders which are updated automatically – with their extensions. These files have to be copied in a folder where a website based on PHP will edit them ...
2
votes
2answers
79 views

Bash script: rename all files below a directory?

Here's what I'd like to do in pseudocode: for subdir in [all first-level subdirectories of the current directory]: for file in [all files in subdir]: rename file to "myprefix_" + ...
2
votes
1answer
65 views

Bash Shell Scripting - How to iterate through files and directories, and copy and rename files?

I have a directory setup as follows: /Group1/audiofile1.wav /Group1/audiofile2.wav /Group1/audiofile3.wav /Group1/audiofile4.wav /Group2/audiofile1.wav /Group2/audiofile2.wav /Group3/audiofile1.wav ...
0
votes
0answers
40 views

Unix pkill error; does wily obstruct me killing the process?

I have two scripts on Unix; one that starts some processes and the other one for killing a process. At first, I ran the .sh without WILY in it and it worked perfectly; in this way, I could also ran my ...
1
vote
1answer
29 views

Writing scripts for use on multiple system with change in some variables etc

The title may not be much clear. I have written some scripts for housekeeping tasks on the Ubuntu servers we maintain. When ever there is a new deployment for a client, I have to change user ids, ...
2
votes
2answers
90 views

Echo multiple lines of text to a file in bash?

How do I write: $count = mysql_num_rows($result); print "<h3>$count metal prices available</h3>"; to a file, index.php? I've tried: echo "$count = mysql_num_rows($result); print ...
0
votes
1answer
35 views

Authenticate connection to remote repository before committing files

All, I have an app (using shell script) that automates the process of committing to svn , generating svn info and emailing it. But every now and then I get the following Authentication realm: < ...
3
votes
2answers
80 views

Automatically reconnect interactive SSH session

What's the best way to automatically reconnect an interactive SSH session to re-establish the shells on terminals? I looked at autossh but that seems to be dedicated to port forwards (which I do not ...
0
votes
0answers
16 views

CScript Terminates before completing task

I am using the below with mods but ziping several Gb of info the last command is Wscript.sleep 2000. I have extended this to 20,000 and 200,000 but I use the script vor various diferent sizes. Is ...
0
votes
1answer
81 views

Trap ctrl-z key to perform cleanup

All, I have a shell script where I want to call a function to do some cleanup if user presses the ctrl-z key(SIGTSTP signal). I read about the trap command and found an example where I can trap the ...
0
votes
1answer
169 views

JAVA main class not found when using Apple auto-ingest tool

I am trying to setup a cronjob to download my daily and weekly reports from iTunes Connect. I have downloaded Apple's Autoingestion.class and I have made the following shell script to download the ...
2
votes
2answers
70 views

awk match whole word

I want to use awk to match whole words from text file. Including words bounded by non alphanumeric characters. For example - string to search for - ABC Source file - HHHABCCCCH HHH ABC ...
0
votes
1answer
59 views

Rsync in bash script not recognizing spaces

An excerpt from a bash script I'm using to backup some photos: #!/bin/bash FROM="/cygdrive/f/\"Trip to Austria\"" TO="/cygdrive/s/\"Trip to Austria\"" rsync -av $FROM $TO When I print the final ...
0
votes
2answers
75 views

File name with spaces piped to two xargs commands

I have a directory and many more subdirectories like the following - file with spaces.txt filewithsuperlonglines.txt ordinaryfile.txt binaryfile.bin The command - find . -type f -print0 | ...
2
votes
1answer
80 views

How can I automate modifying key/value pairs in a shell script?

I often want to automate this sort of task in a shell script: if the line: SOMEKEY=SOMEVALUE exists in a file, then change it to SOMEKEY=SOMEOTHERVALUE otherwise, append the line ...
1
vote
3answers
60 views

Find strings that appear consecutively in a file

All, I have a file where strings appear on each line in following format: STRING1 STRING2 STRING1 STRING1 STRING1 STRING3 STRING4 STRING4 STRING5 STRING6 STRING5 I want to ...
5
votes
6answers
160 views

Find all filename.ext1 where no filename.ext2 exists in OS X or the shell

I need to create both TIF and JPG versions of a large set of images. All JPG images already exist, but only a part of the TIF images. Is there an easy way to search a directory to find all JPG files ...
3
votes
3answers
142 views

How to sync a Portable Apps folder?

Couldn't find a good resource for this particular dilemma, so I thought asking the good people at super user for help. Background: I am a portable apps enthusiast, and whenever possible, my apps are ...
6
votes
3answers
128 views

Should I put *.sh and *.rb file extensions on all my scripts?

I have a bunch of hand-rolled executable scripts in my $HOME/bin directory. Some are written in bash, some in Ruby. All of them have the shebang line at the top telling the shell what interpreter to ...

1 2 3 4 5