| MLUG Bash Scripting Workshop 25/04/08 | ||
|---|---|---|
| Prev | Index | Next |
That's Scriptshow ............. not Stripshow!
I originally wanted to explain a bit more about Bash usage and introduce a couple other things before proceeding to my next example script.
However, I realised that it would require several pages and never be as comprehensive as I would have liked so I opted instead to put it all in a script that runs for 9 minutes and 57 seconds on this box according to time and which was fun to put together in a challenging sort of way
I said script, but actually there are 21 scripts. Example06 is actually the main script which runs the 20 other scripts which were named in numerical order
It would be helpfull if you could run this script before we moved on.
If you want to see how it looks before you run it check below.
#!/bin/bash
# example06
# A script that runs 20 other numbered scripts.
#
# If no first and last numbers are provided the default
# is 1 through 20.
#
# If just one number is provided it will start at that
# (numbered) script.
first=$1
last=$2
tute_path=./tute/tute
test -n "$first"
if [ $? -eq 1 ]; then
first=0 # the first script default is tute0
fi
test -n "$last"
if [ $? -eq 1 ]; then
last=20 # the last script default is tute19
fi
while [ $first -le $last ]; do # While the first is <= last
$tute_path$first # run command tuteX
let first=$first+1 # increase by one
done
# End of script