Subject: Another bash scripting question...
From: Jeff Ross (jeffross@vcn.com)
Date: Thu Nov 18 1999 - 07:48:51 MST
Hi all!
A bash scripting question, so if this isn't your cup of tea, please feel
free to pass over this message :-)
This came up in my unix class. Part of the last scripting assignment
was to display all the positional parameters set by bash when a script
is called.
I wanted to do it in a loop and this little code piece is what I came up
with to test the idea.
count=1
echo $# $*
while [ $# -ge $count ]
do echo ${count}
let count=$count+1
done
If this little script is called by typing sh looptest one two three,
the echo${count} displays the value of count (1 2 3) instead of the
value of $1 $2 or $3, so substitution isn't occurring in the loop.
My instructor and I tried with no success to get this to work last night
at lab. Any ideas? Or is this something that just can't be done in
bash?
Awaiting enlightenment :-)
Jeff
This archive was generated by hypermail 2a24 : Fri Dec 03 1999 - 19:07:33 MST