Return to BSD News archive
Newsgroups: comp.os.386bsd.questions Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!pacbell.com!amdahl!amdahl.uts.amdahl.com!agc From: agc@uts.amdahl.com (Alistair G. Crooks) Subject: Re: pwd in the prompt Message-ID: <1994Apr11.083609.16557@uts.amdahl.com> Organization: Amdahl Corporation, Sunnyvale CA References: <2nrmmu$lql@hermes.unt.edu> <ghcPO2q00iM8I0flE9@andrew.cmu.edu> <1994Apr8.132929.9611@gmd.de> Date: Mon, 11 Apr 1994 08:36:09 GMT Lines: 36 In article <1994Apr8.132929.9611@gmd.de> veit@mururoa.gmd.de (Holger Veit I5.EDS) writes: >|> > In article <2nrmmu$lql@hermes.unt.edu>, wilsonm@dale.hsc.unt.EDU (Mike Wilson)\ >|> > writes: >|> > |> Simply, I want to have the path in the prompt, I have tried several >|> > |> different ways but have yet to get it to work correctly. Does anyone out >|> > |> there have something I can use? >|> > > >For quite a long time I use something like the following in .cshrc: > >set prompt='[\!]'$cwd'>' >alias cd 'cd \!*;set prompt=\[\!\]$cwd\>' > >giving a prompt (with history) like > >[53]/usr/src/sys/arch/i386/isa> Yes, I used to do the same, but this fails if you use directory stacks, and push and pop directories will both change to the new directory without resetting the prompt. So what I've used (in my .cshrc) for a while is: if ($?prompt) then alias setprompt 'set prompt = "$USER@`hostname -s`:`pwd`(\\!)% "' alias cd 'cd \!*; setprompt' alias pushd 'pushd \!*; setprompt' alias popd 'popd \!*; setprompt' setprompt endif Alistair -- Alistair G. Crooks (agc@uts.amdahl.com) +44 252 346377 Amdahl European HQ, Dogmersfield Park, Hartley Wintney, Hants RG27 8TE, UK. [These are only my opinions, and certainly not those of Amdahl Corporation]