Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!cheops.cis.ohio-state.edu!karl From: karl@cheops.cis.ohio-state.edu (Karl Kleinpaste) Newsgroups: comp.unix.wizards Subject: Re: Using the directory stack like !-2:3 in csh Message-ID: <13657@tut.cis.ohio-state.edu> Date: 18 May 88 19:23:22 GMT References: <115@lakart.UUCP> Sender: news@tut.cis.ohio-state.edu Lines: 40 In-reply-to: dg@lakart.UUCP's message of 17 May 88 15:34:38 GMT Tcsh provides for direct access to the directory stack with a modification to the syntax for filenames. From the tcsh man page, 14. DIRECTORY STACK ELEMENT ACCESS Tcsh will now allow the user to access all elements in the directory stack directly. The syntax "=" is recog- nized by tcsh as indicating a particular directory in the stack. (This works for the file/command name recognition as well.) This syntax is analogous to the ~ syntax for access to users' home directories. The stack is viewed as zero- based, i.e., =0 is the same as $cwd, which is the same as ".". As a special case, the string "=-" is recognized as indicating the last directory in the stack. Thus, > dirs /usr/net/bin /usr/spool/uucp /usr/accts/sys > echo =2 /usr/accts/sys > ls -l =1/LOGFILE -rw-r--r-- 1 uucp 2594 Jan 19 09:09 /usr/spool/uucp/LOGFILE > echo =-/.cs* /usr/accts/sys/.cshrc > echo =4 Not that many dir stack entries. > Tcsh will complain if you ask for a directory stack item which does not exist. I put this to use by having, in my .cshrc, the lines pushd /usr/spool/uucp pushd /u/osu/src pushd +2 Thereafter, I can use =1 to get at things under our source area, and =- to check on the state of UUCP things. Tcsh was distributed over comp.sources.unix a while back. Check a nearby archive site. --Karl