Using the directory stack like !-2:3 in csh
Richard A. O'Keefe
ok at quintus.UUCP
Wed May 18 19:18:02 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??
Not directly, but it isn't hard.
(1) In your .cshrc file, introduce a new variable to hold the directory stack:
set dirs = `dirs`
(2) The commands which can change the directory stack are pushd, popd, cd.
Introduce aliases for them which maintain the directory stack.
alias pushd 'pushd \!* ; set dirs = `dirs`'
alias popd 'popd \!* ; set dirs = `dirs`'
alias cd 'chdir \!* ; set dirs = `dirs`'
(3) Now you're away laughing. All you have to do is write
$dirs[3]/tcp.ip.h
More information about the Comp.unix.wizards
mailing list