PS1='$
Ron Stanions
sauron at dsoft.UUCP
Sun Jan 7 10:00:09 AEST 1990
Lines: 35
In article <25a56e70:639.1comp.unix.questions;1 at tronsbox.UUCP>
tron1 at 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 at 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!
More information about the Comp.unix.questions
mailing list