Finding the last arg

Lawrence V. Cipriani lvc at cbnews.att.com
Wed Jan 2 02:57:14 AEST 1991


In article <18476 at shlump.nac.dec.com>, lan_csse at netrix.nac.dec.com (CSSE LAN Test Account) writes:

> The pseudo-code I'd like to use is:
> 	if [ -d last-command-line-arg ]
> 	then
> 		...
> 	fi

If you don't need to have the last command line argument in a variable you
can do this:

	if eval [ -d "\${${#}}" ]
	then
		...
	fi
-- 
Larry Cipriani, att!cbvox!lvc or lvc at cbvox.att.com
"I just love the smell of gunpowder!" - Bugs Bunny



More information about the Comp.unix.shell mailing list