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

Steve Lane steve at geac.UUCP
Tue May 24 23:11:15 AEST 1988


In article <115 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) writes:
>
>but what I really want to do is to be able to say:
>
>    @:3/tcp.ip.h
>
>where @:3 gets the third entry on my directory stack.
>
>Can I do this??
>-- 
>	dg at lakart.UUCP - David Goodenough		+---+
>							| +-+-+
>	....... !harvard!adelie!cfisun!lakart!dg	+-+-+ |
>						  	  +---+

You can use the 'dirs' command, and alias the usual directory commands in the
following manner:

- include the following shell variable initialization in your .login
	set d=$HOME

- and add three lines to your .cshrc
	alias cd    'cd \!*;set d=`dirs`'
	alias pushd 'pushd \!*; set d=`dirs`'
	alias popd  'popd; set d=`dirs`'

In that way, your directory stack is always saved in $d[1], $d[2], ... with
$d[1] being your current working directory.
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Steve Lane,                        UUCP: ...[mnetor, yunexus, utgpu]!geac!steve
Geac Computers International Inc.
Markham, Ontario.  (416) 475-0525



More information about the Comp.unix.wizards mailing list