Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!apple!amdahl!jonc From: jonc@uts.amdahl.com (Jonathan Chang) Newsgroups: comp.unix.questions Subject: KSH script arguments Message-ID: Date: 29 Aug 90 19:54:58 GMT Reply-To: jonc@amdahl.uts.amdahl.com (Jonathan Chang) Distribution: comp.unix.questions Organization: Amdahl Corporation, Sunnyvale CA Lines: 21 This is my first visit in this group; hope this is where all the gurus hang out. I want to pose a somewhat trivial question: 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? Or can someone explain how to get to it (without shifting)? P.S. Just to add to the challenge, the number of arguments is variable. Thanks! jonc@uts.amdahl.com