Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!umd5!brl-adm!adm!rbj@icst-cmr.arpa From: rbj@icst-cmr.arpa (Root Boy Jim) Newsgroups: comp.unix.wizards Subject: Using the directory stack like !-2:3 in csh Message-ID: <15035@brl-adm.ARPA> Date: 28 May 88 02:49:05 GMT Sender: news@brl-adm.ARPA Lines: 35 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. Even better is to replace `d' with `argv', then you can just reference $1, $2, etc! BTW, popd should have a \!* as well, to handle `popd +2', etc. Strictly speaking, the set command should have parens around the dirs command, altho it seems to work anyway, probably because of the order in which command substitution, blank interpretation, and builtin commands are handled. Note to Paul Placeway: given this technique, there is no reason to support the `=' construct in tcsh, altho I do appreciate its being there. Now to fix up my aliases... -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Steve Lane, UUCP: ...[mnetor, yunexus, utgpu]!geac!steve Geac Computers International Inc. Markham, Ontario. (416) 475-0525 (Root Boy) Jim Cottrell National Bureau of Standards Flamer's Hotline: (301) 975-5688 The opinions expressed are solely my own and do not reflect NBS policy or agreement My name is in /usr/dict/words. Is yours?