You can use the shift example below to get rid of the first parameter. Then
at that point the $# will give you the number of parameters left. Then you
can loop thru the remaining parameters $1, $2, ... to the second to last one
$# - 1.  That should give you what you want.

I am no script expert. I just got the idea from a book I bought (recommended
on this list). "Portable Shell Programming" by Bruce Blin.  It is a good and
easy read with plenty of explained examples.

Good luck

Terry

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Todd A. Jacobs
Sent: Thursday, March 13, 2003 3:41 PM
To: [EMAIL PROTECTED]
Subject: Re: a question about shell script

On Thu, 13 Mar 2003, Jihuang Zhou wrote:

> Anybody knows how to get an input parameter list from the second
> parameter to the second last?  For example, if $*="aa bb cc ....mm nn",

Why not just shift away the first parameter?

        foo=$1
        shift
        bar="$*"

--
Guvf gntyvar jnf rapbqrq jvgu gur ebg13.fu fpevcg, ninvynoyr ng
uggc://jjj.pbqrtabzr.bet/fpevcgvat/fubjfpevcg.cuc?fpevcg=ebg13.fu be
sebz n furyy-fpevcgvat nepuvir arne lbh!

                        - ROT-13 Encoded Message





-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to