KSH script arguments
Brian Kenney
kenney at hsi.UUCP
Thu Aug 30 21:40:44 AEST 1990
In article <b4CC02oVc3Jx01 at amdahl.uts.amdahl.com> jonc at amdahl.uts.amdahl.com (Jonathan Chang) writes:
>How can I extract the last argument to a ksh script?
>Example:
> myscript arg1 arg2 arg3
>Within the script, I want to (easily) know the value of 'arg3'.
>$# returns the number of arguments, $1 is the first argument,
>but what's the variable that cotains the last argument?
>Thanks!
>jonc at uts.amdahl.com
args=$*
arg3=${args##* }
You're welcome.
I got this from The Kornshell Command and Programming Language by
Bolsky and Korn. I highly recommend it.
--
Brian Kenney kenney at hsi.com
More information about the Comp.unix.questions
mailing list