Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!nwnexus!amc-gw!stuart From: stuart@amc-gw.amc.com (Stuart Poulin) Newsgroups: comp.unix.shell Subject: Re: Finding the last arg Keywords: Bourne shell arguments Message-ID: <4717@amc-gw.amc.com> Date: 5 Jan 91 01:28:23 GMT References: <18476@shlump.nac.dec.com> <1990Dec27.154917.14751@virtech.uucp> <811@npdiss1.StPaul.NCR.COM> Reply-To: stuart@tfatf.amc.com (Stuart Poulin) Organization: Applied Microsystems, Redmond, WA Lines: 17 Of course if you know the last arg will never have white space and the command line wont have args like "=", you can use expr: Last=`expr "$*" : '.* \(.*\)' \| "$*"` -or- Use awk, it can handle a "=" by itself but still no white space. Last=`Last=`echo "$*" | awk '{ print $NF }'` -or- Something with sed or grep. I like the "for last do :; done" method - it's very clever and always works. Stuart Poulin DNS: stuart@amc.com Applications Engineer/System Administrator Applied Microsystems Corporation UUCP: amc-gw!stuart Redmond, Washington 98073 Dial: 800-ASK-4AMC,206-882-2000