Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!hsi!kenney From: kenney@hsi.UUCP (Brian Kenney) Newsgroups: comp.unix.questions Subject: Re: KSH script arguments Message-ID: <1992@hsi86.hsi.UUCP> Date: 30 Aug 90 11:40:44 GMT References: Reply-To: kenney@hsi.com (Brian Kenney) Distribution: comp.unix.questions Organization: Health Systems Intl., New Haven, CT. Lines: 23 In article jonc@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@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@hsi.com