Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!NUSVM.BITNET!GBOPOLY1 From: GBOPOLY1@NUSVM.BITNET (fclim) Newsgroups: comp.sys.apollo Subject: Re: go to old directory == 'back' ?? Message-ID: <8906280435.AA18692@umix.cc.umich.edu> Date: 28 Jun 89 04:35:17 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 58 X-Unparsable-Date: Wed, 28 Jun 89 12:34:08 SST >Date: 9 Jun 89 22:01:09 GMT >From: danny%idacom%alberta%att.uucp@ucbvax.Berkeley.EDU (Danny Wilson) >Organization: IDACOM Electronics Ltd., Edmonton, Alta. >Subject: go to old directory == 'back' ?? >Message-Id: <678@idacom.UUCP> > >When using the C shell, I have a handy alias that returns you to >the directory you were just in. This involves making an alias >for 'cd' and 'back': > > alias cd set old=$cwd; chdir !* > alias back set back=$old; set old=$cwd; cd $back; unset back; dirs > A better method (since you're using csh) is to use pushd. This is faster 'cos it's a built-in function of csh. % pwd foo % pushd bar bar foo % pwd bar % pushd foo bar % pwd foo % pushd bar foo % pwd bar You could pushd-ed more directories onto the stack internal to csh. Use "dirs" to list the stack. Use "pushd " to move the nth entry to the top of the stack. >I thought this would be a great function for the Aegis shell. I made >the following shell scripts: >(/com/sh scripts deleted) (no square brackets on my keyboard -- fclim) > >However, because the variable 'old' gets set at a lower shell level it >is undefined within program 'back'. Has anyone got a solution for >a (seemingly) easy problem like this? I was thinking of implementing pushd/popd/dirs for Aegis users but have not get round to it. I was thinking of using paste_buffers. (This is one way of passing global info). Has anyone done so yet? >Danny Wilson >IDACOM Electronics danny@idacom.uucp >Edmonton, Alberta alberta!idacom!danny >C A N A D A fclim --- gbopoly1 % nusvm.bitnet @ cunyvm.cuny.edu computer centre singapore polytechnic dover road singapore 0513.