Shell Scripting

Ben Smithurst ben at scientia.demon.co.uk
Tue Mar 7 22:34:55 GMT 2000


Gary Brewer wrote:

> What I really need to know is how would I get the string in the last
> argument passed ?
> 
> I thought it was ${$#} but in csh this just echoed a number not a string.

/bin/sh:

eval foo=\$$#
echo $foo

maybe there's a cleaner way.

/bin/csh:

echo $argv[$#argv]

(of course, csh shouldn't be used for scripts.)

-- 
Ben Smithurst / ben at scientia.demon.co.uk / PGP: 0x99392F7D





More information about the Ukfreebsd mailing list