Using the directory stack like !-2:3 in csh

Steve Hayman sahayman at watmath.waterloo.edu
Wed May 18 17:44:55 AEST 1988


In article <115 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) 
asks about a way to refer to the entries on csh's directory stack.

I have this in my .cshrc, I'm sure there are other ways but this is pretty
simple.  This lets me use $1, $2 and so on to refer to the directory
stack entries.


if ( ! $?prompt ) goto skipprompt

	 ... various other things for interactive shells only ...

	alias	cd	'cd \!*; setdirs'
	alias	pushd	'pushd \!*; setdirs'
	alias	popd	'popd \!*; setdirs'
	alias	setdirs	'set argv=(`dirs`)'
	
skipprompt:

Hope this is of some use to somebody.


Steve Hayman         Math Faculty Computing Facility     University of Waterloo
watmath!sahayman        sahayman at math.waterloo.edu        sahayman at water.bitnet



More information about the Comp.unix.wizards mailing list