How To: set PS1 to show users "current" directory?
Dave Close
davec at shared.uucp
Sat Apr 13 12:50:12 AEST 1991
In article <1599 at msa3b.UUCP> mgphl at msa3b.UUCP (Michael Phillips) writes:
>Trying to set up AIX on a PS/2 & have users that want their command
>prompt to show their current directory (aka: $P$G in **DOS).
If you are using an xterm, either SVr4 or aixterm, the following might
also be of use. It doesn't make your prompt so verbose and is always
present. If installed in the ENV file for ksh of all users, the display
even changes properly when you use 'su'.
_cd () {
unalias cd
cd ${@}
alias cd=_cd
if [ "$(whoami)" = "root" ] ; then
pmt=\#
else
pmt=\$
fi
export PS1="^[]0;$(hostname -s):$(whoami) ${PWD}^G${pmt} "
}
[ "${TERM}" = "aixterm" -o "${TERM}" = "xterm" ] && {
alias cd=_cd
typeset -fx _cd
if [ "$(whoami)" = "root" ] ; then
pmt=\#
else
pmt=\$
fi
PS1="^[]0;$(hostname -s):$(whoami) ${PWD}^G${pmt} "
export PS1
}
Note, replace the ^[ and ^G with actual escape and bell characters.
There are trailing spaces on the lines with pmt=.
--
Dave Close Shared Financial Systems Dallas
davec at shared.com vmail +1 214 458 3850
uunet!shared!davec fax +1 214 458 3876
My comments are my opinions and may not be shared by Shared.
More information about the Comp.unix.aix
mailing list