Prompt changing on the fly - Oops
lvc at danews.UUCP
lvc at danews.UUCP
Mon Jan 19 06:09:47 AEST 1987
>What shell are you using? It is possible in the Korn shell.
>Impossible in the Bourne shell. I don't know about the C-shell.
>My prompt includes a clock that is updated at every return.
Later that same day:
Oops, it is possible in the Bourne shell. What you can do
is define a function (not well known in the Bourne shell)
to do your cd's and set PS1.
chdir()
{
case ${#} in
1) cd $1 && PS1="`pwd` "
;;
*) echo "usage: chdir directory" >&2
return 1
;;
esac
}
Now just use chdir instead of cd.
In the Korn Shell, you can do something like:
PS1='${PWD} '
This works because PS1 is *evaluated* every time it is printed.
You can use cd and PS1 is updated automatically.
--
Larry Cipriani Cornet 353-4999 AT&T (614) 860-4999
{ihnp4|cbosgd}!cbsck!lvc AT&T Network Systems rm 2B-220
More information about the Comp.unix.wizards
mailing list