Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.unix.wizards Subject: Re: Using the directory stack like !-2:3 in csh Summary: indirect method Message-ID: <992@cresswell.quintus.UUCP> Date: 18 May 88 09:18:02 GMT References: <115@lakart.UUCP> Organization: Quintus Computer Systems, Mountain View, CA Lines: 19 Posted: Wed May 18 02:18:02 1988 In article <115@lakart.UUCP>, dg@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