Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!rpi!rpi.edu!tale From: tale@its.rpi.edu (David C Lawrence) Newsgroups: comp.unix.questions Subject: Re: Getting UNIX prompt to display curr Message-ID: Date: 25 Mar 89 06:50:20 GMT References: <5582@ncsugn.ncsu.edu> <47800029@uxe.cso.uiuc.edu> <1383@deimos.cis.ksu.edu> <2113@cveg.uucp> Sender: usenet@rpi.edu Reply-To: tale@pawl.rpi.edu Distribution: comp Organization: The Octagon Room Lines: 47 In-reply-to: jms@hcx.uucp's message of 25 Mar 89 04:21:31 GMT In article <2113@cveg.uucp> jms@hcx.uucp (Michael Stanley) writes: MS> Ah, but csh includes the environment variable $cwd. This makes setting MS> foo unnecessary. It seems to me that you could remove the part that says: MS> set foo=`pwd` MS> and replace every occurrence of $foo with $cwd. MS> I haven't actually tested these examples so I hope I didn't just stick MS> my foot in my mouth, but I did do something like this once so I'm pretty MS> sure it'll work. Well, you didn't necessarily stick your foot in your mouth. $cwd works just fine for people who don't care where they REALLY are in the directory tree (ie, those who never bother with .. ). However, for those of us who do use .. as a convenient shorthand way to move around directories, $cwd doesn't cut it. If the directory to which you changed was in reality a symbolic link, $cwd (and dirs) reports the name of the link, not the final destination. Using pwd for the prompt insures that the actual current directory will be displayed. For anyone who is really interested in the 80 000 ways that other people are setting their prompt, here's my obligatory contribution. Perhaps the original fellow who asked the question (with the Bourne shell) would like to get tcsh -- prompt-people can play to their hearts delight in it. The following are in tcsh: alias precmd pwd set prompt="%m:`whoami` (%h) " to give me: /home/h/tale/News consult1:tale (87) tcsh also has an available variable "cwdcmd" to be executed whenever the current value of cwd changes. This can be set to change the window label of a shelltool, for example, by aliasing it to alias cwdcmd echo ^[]l$cwd^[\\ For those interested, tcsh is available from tut.cis.ohio-state.edu via anonymous ftp. Dave -- tale@rpitsmts.bitnet, tale%mts@itsgw.rpi.edu, tale@pawl.rpi.edu