6.01.2010

bash scripting

I wanted to put together a simple bash script that would take a wildcard argument from the command-line and send the output to a text file (g03data.sh *.log > output.txt)

I needed to add the following (found here) to the top of my existing script:

if [ -z "$1" ] then     echo $0: usage: $0 filename     exit 1 fi
while [ ! -z "$1" ] do     # do stuff to $1     shift done
exit 0

No comments:

Post a Comment