Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!asuvax!mcdphx!mcdchg!ddsw1!tronsbox!dsoft!sauron From: sauron@dsoft.UUCP (Ron Stanions) Newsgroups: comp.unix.questions Subject: Re: PS1='$ Message-ID: <461@dsoft.UUCP> Date: 6 Jan 90 23:00:09 GMT References: <8229@ingr.com> <25a56e70:639.1comp.unix.questions;1@tronsbox.UUCP> Lines: 38 Lines: 35 In article <25a56e70:639.1comp.unix.questions;1@tronsbox.UUCP> tron1@tronsbox.UUCP (HIM) writes: > >>I noticed in a recent discussion that using PS1='${PWD}' will cause the >>working directory path to become the UNIX prompt. This works fine, but > >Certainly didn't work for ME! > >(ISC 2.0.2 "sh") No, not in an sh shell. it does work, however, in the ksh shell. >Try this > >PS1=[`pwd`]`echo " $ "` > >to get > >[/usr/foo] $ > The problem with this approach is that it will only be true for as long as you stay in that directory. in the example above for the ksh shell, it will properly display the current directory no matter what directory you move to. there is no way that I'm aware of for it to be done in an sh shell. the csh shell allows it to be done using an alias on the cd command, but this too will be broken if you decide to use chdir instead. also, pushd, popd, and any other directory motion commands will break csh prompts. ksh seems to be the only one with the completely working approach. -- Ron Stanions -- sauron@dsoft \_/\--/\_/ All things posted by me are dsoft system administrator < \ / > by-products of a deranged mind Dragonsoft Development \ / from spending too many hours ...!uunet!tronsbox!dsoft!sauron `\oo/' trying to make uucp work!