Path: utzoo!attcan!uunet!mcvax!ukc!axion!iwarner From: iwarner@zaphod.axion.bt.co.uk (Ivan Warner,G44 SSTF,6632,) Newsgroups: comp.unix.questions Subject: Re: alias to link cd to pwd Message-ID: <1737@zaphod.axion.bt.co.uk> Date: 9 Jun 89 10:15:53 GMT References: <3710@tank.uchicago.edu> Sender: news@axion.bt.co.uk Reply-To: iwarner@zaphod.axion.bt.co.uk Lines: 32 From article <3710@tank.uchicago.edu>, by phd_ivo@gsbacd.uchicago.edu: > A long time ago, I had a script that links a cd to > reset the prompt to the currently connected directory. > > Unfortunately, I can't find it anymore, and my documentation > is not telling me how to delay the execution of `pwd` in something > like > > alias cd "cd \!^ ; set prompt=`pwd`" > > Could someone please post a copy of such an alias, please? > Incidentally, I am running a NeXT with Mach, a Berkeley 4.3BSD > variation without ksh but with csh. Here's mine: -------------------------------------------------------------------------- alias cd '\!\! ; set prompt="! $cwd:t> "' alias pushd '\!\! ; set prompt="! $cwd:t> "' alias popd 'popd ; set prompt="! $cwd:t> "' -------------------------------------------------------------------------- This gives a prompt with the command number (useful for history substitution) and the last component of the directory path (the tail). If you want the whole pathname in the prompt remove the `:t' after the $cwd. Ivan Warner.