Besides the problem you mention with a garbled status line, your approach
based on PS1 has the following drawbacks:
o as your status line grows with increasing cwd depth, the shifting point
of the command line (displayed as '<' by ksh) moves to the left in parallel; with a 50 char status line and '$ ' as your prompt, e.g., your command line
will be rolled over by ksh already after typing in 11 characters
(in a 80x25 aixterm).
o aixterm has to interpret a lot of esc sequences with each PS1 issued;
even without ever changing directories, you're doing more i/o.
My approach based on aliasing cd does indeed have the drawback of a stale
status line after telnet'ing or rlogin'ing to another host where the same
.kshrc is in effect; you can, however, always update your line by a 'cd .'
I don't know of a way to get around this. The problem with subshells (as long
as they are ksh's) and su's is fixed in the following version (do keep in
mind though, that the whole thing is still a quick shot and not a mature
shell environment; you may still encounter some side effects):
=== cut ===
tty -s
if [ -z "${0#/bin/ksh}" -o -z "${0#-ksh}" -o -z "${0#ksh}" -a $? = 0 ] ; then
INTERACTIVE=on
else
INTERACTIVE=off
fi
if [ $INTERACTIVE = "on" ] ; then
if [ $TERM = aixterm ] ; then
OPWD=$PWD
HOST=`uname -n`
BOLD="\033[1m"
TSL="\033[?1T"
FSL="\033[?F"
EL="\033[K"
SGR0="\033[0;10m"
KCUU1="\033[A"
cwd () {
cd $*
echo $TSL$EL"You are on "$HOST" in "$BOLD$PWD$SGR0$FSL$KCUU1
}
alias cd=cwd
fi
if [ $TERM = vt220 ] ; then
cwd () {
cd $*
PS1=$PWD"> "
export PS1
}
alias cd=cwd
fi
fi
if [ $INTERACTIVE = "on" ] ; then
echo
cd .
trap "cd $OPWD" EXIT
fi
=== cut ===
--
Konrad Haedener Phone: +41 31 65 42 25
Institute for Physical Chemistry FAX: +41 31 65 44 99