[comp.unix.questions] PS1='$

tron1@tronsbox.UUCP (HIM) (01/06/90)

>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")

Try this

PS1=[`pwd`]`echo " $ "`

to get 

[/usr/foo] $ 

for a login

****************************************************************************
Everything I say is (c) 1990, except the stuff I stole from someone else
and the stuff I don't want responsibility for.
 
Kenneth J. Jamieson: Xanadu Enterprises Inc. "Professional Amiga Software"
      UUCP: tron1@tronsbox.UUCP  BEST PATH ---> uunet!tronsbox!tron1 
      Sysop, Romantic Encounters BBS - (201)759-8450 / (201)759-8568 
****************************************************************************

tron1@tronsbox.UUCP (HIM) (01/06/90)

Lines: 18

>PS1=[`pwd`]`echo " $ "`
>
>to get 
>
>[/usr/foo] $ 

NOTE - it wont CHANGE unless had a script replace the CD command and do the
above.

(I could be way wrong here)
****************************************************************************
Everything I say is (c) 1990, except the stuff I stole from someone else
and the stuff I don't want responsibility for.
 
Kenneth J. Jamieson: Xanadu Enterprises Inc. "Professional Amiga Software"
      UUCP: tron1@tronsbox.UUCP  BEST PATH ---> uunet!tronsbox!tron1 
      Sysop, Romantic Encounters BBS - (201)759-8450 / (201)759-8568 
****************************************************************************

sauron@dsoft.UUCP (Ron Stanions) (01/07/90)

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!