Getting UNIX prompt to display current directory
Steven Hagar
shagar at vpk4.UUCP
Wed Mar 22 09:13:05 AEST 1989
The one thing that I didn't like about putting the current directory in PS1
was that if I was in something like "/usr/spool/uucppublic/receive/..."
there wasn't much space left on the line to see the command I was typing.
An alternate approach that I found useful was to display the current
directory in the status field of my terminal. Here are the functions
that I use within Bourne and Korn shells on AT&T terminals:
case ${TERM} in
605|610|615)
pd(){
cd $1
msg=`uname`": "`pwd`
len=`expr 80 - "${msg}" : '.*'`
sp=" "
echo "^[7\033[x${sp}${sp}${sp}${sp}\c"
echo "\033[25;${len}x${msg}^[8\c"
};;
630)
pd(){
cd $1
msg=`uname`": "`pwd`
len=`expr "${msg}" : '.*'`
echo "\033[?${len};2v${msg}\c"
};;
esac
(suggestions for removing nasty terminal dependencies welcomed --
please send comments or questions via e-mail)
--
Steven Hagar .
AT&T Canada Inc. . ATTMAIL: !shagar
(416) 756-5061 . UUCP: uunet!attcan!shagar
More information about the Comp.unix.questions
mailing list