Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ncr-sd!geoff From: geoff@ncr-sd.SanDiego.NCR.COM (Geoffrey R. Walton) Newsgroups: comp.unix.questions Subject: Re: current pwd in prompt Summary: Here we go again! Message-ID: <2036@ncr-sd.SanDiego.NCR.COM> Date: 13 Feb 88 00:05:16 GMT Expires: 31 Dec 69 23:59:59 GMT References: <11656@brl-adm.ARPA> <9481@steinmetz.steinmetz.UUCP> Reply-To: geoff@ncr-sd.SanDiego.NCR.COM (Geoffrey R. Walton) Followup-To: my mom, she loves it when people talk about me Distribution: na Organization: Western United Intergalactic Pacifier and Cane Corp., Ltd. Lines: 48 Bill Davidsen writes: that someone else wrote: Can anyone explain to me how to get my prompt to be the current directory? I have tried several methods without any success. It seems that no matter what method I try, the prompt is evaluated once and never changes. [so he said] >You use the value of PWD, which is the name you want. i.e.: > PS1='$PWD > ' >I have seen people saying that you can use `pwd` in the prompt, but >that doesn't work in any of the versions I have seen over the last >few years. $PWD does. All this is well and good for the Bourne shell, but much more is possible with csh or (I've been told, we don't have it) ksh. I have aliases which include history number, machine name, AND current directory as pieces of my prompt. Sure, it's cumbersome, but it keeps me from getting lost as I bounce from machine to machine (is it seven or eight?) and wander all over the file system of each. A long prompt is MUCH better than a trail of bread crumbs. All seriousness aside, here are tha aliases I use -- and no, they DON'T add a lot of overhead; "pwd" and "uuname" are _NOT_ evaluated evertime I get a prompt, only when I change directory. set prompt="\!:`uuname -l`:[`pwd`] " alias pushd 'pushd \!* ; set prompt="\\!:`uuname -l`:[`pwd`] "' alias popd 'popd ; set prompt="\\!:`uuname -l`:[`pwd`] "' alias cd 'cd \!* ; set prompt="\\!:`uuname -l`:[`pwd`] "' Of course, you COULD use $cwd, if you wanted. #include Geoff Walton Software Publications NCR E&M San Diego geoff.walton@SanDiego.NCR.COM or {sdcsvax,cbosgd,pyramid,nosc.ARPA,ihnp4}!ncr-sd!geoff Even the smallest problem becomes unsolvable if enough meetings are held to discuss it.