# kterm,xterm のタイトルに prompt を表示する if [ "$TERM" = "screen" ] ; then SCREEN=screen@ fi case $TERM in kterm|xterm|screen) HN=$SCREEN`hostname` function termtitle () { echo "]0;$*" ; } termtitle $HN:$PWD function cd () { builtin cd "$@" ; termtitle $HN:$PWD ; } function popd () { builtin popd $* ; termtitle $HN:$PWD ; } function pushd () { builtin pushd $* ; termtitle $HN:$PWD ; } function pwd () { builtin pwd ; termtitle $HN:$PWD ; } function su () { termtitle "$HN:su $*($PWD)" ; if [ "$1" = "-c" ] ; then command su -c "$2"; elif [ "$2" = "-c" ] ; then command su $1 -c "$3" elif [ "$3" = "-c" ] ; then command su - $2 -c "$4" else command su $* ; fi termtitle $HN:$PWD ; } function ssh () { termtitle "$HN:ssh $*" command ssh $* termtitle $HN:$PWD } function emacs () { termtitle "$HN:$PWD -- emacs $*" command emacs $* termtitle $HN:$PWD } function less () { termtitle "$HN:$PWD -- less $*" command less $* termtitle $HN:$PWD } function screen () { termtitle "$HN:$PWD -- screen" command screen $* termtitle $HN:$PWD } ;; esac #pwd