Steve Youngs wrote:
>
<snip>
> Here's what I have..
>
<snip>
> | while [ $LOOP -le $LOOP_TIMES ]; do
> | cat $FILE | tr "\r" "\n" > $FILE
> | somehow increment $FILE from $1 to $2, $3, $4 etc up to $#
> | LOOP=$[ LOOP + 1 ]
> | done
> `----
>
<snip>
You can use the eval command:
$ showargs() {
for i in $(seq $#); do
eval FILE=\$$i
echo $FILE
done
}
$ show_args one two three
one
two
three
or you can use the shift built-in command:
$ show_args() {
while : ; do
FILE=$1
echo $FILE
shift || break
done
}
Although this takes an extra round which finds $1 unset in the last
loop. The details are left as an exercise :-)
Marc
--
Marc Mutz <[EMAIL PROTECTED]> http://marc.mutz.com/Encryption-HOWTO/
University of Bielefeld, Dep. of Mathematics / Dep. of Physics
PGP-keyID's: 0xd46ce9ab (RSA), 0x7ae55b9e (DSS/DH)
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs
- Re: shell script question Steve Youngs
- Re: shell script question Jack Barnett
- Re: shell script question Steve Youngs
- Re: shell script question Jack Barnett
- Re: shell script question Steve Youngs
- Re: shell script question Steve Youngs
- Re: shell script question Greg Olszewski
- Re: shell script question Steve Youngs
- Re: shell script question Greg Olszewski
- Re: shell script question Steve Youngs
- Re: shell script question Marc Mutz
- Re: shell script question Steve Youngs
- Re: shell script question Steve Youngs
- Re: shell script question T. Sean (Theo) Schulze
- Re: shell script question Steve Youngs
- Re: shell script question Richard Adams
- Re: shell script question Steve Youngs
- Re: shell script question T. Sean (Theo) Schulze
- Re: shell script question Steve Youngs
- shell script question Jim Reimer
- Re: shell script question Marc Mutz
