Check this out:
http://www.unixguide.net/unix/faq/2.4.shtml
Bourne Shell (sh):
If you have a newer version of the Bourne Shell (SVR2 or newer)
you can use a shell function to make your own command, "xcd" say:
xcd() { cd $* ; PS1="`pwd` $ "; }
If you have an older Bourne shell, it's complicated but not
impossible. Here's one way. Add this to your .profile file:
LOGIN_SHELL=$$ export LOGIN_SHELL
CMDFILE=/tmp/cd.$$ export CMDFILE
# 16 is SIGURG, pick a signal that's not likely to be used
PROMPTSIG=16 export PROMPTSIG
trap '. $CMDFILE' $PROMPTSIG
and then put this executable script (without the indentation!),
let's call it "xcd", somewhere in your PATH
: xcd directory - change directory and set prompt
: by signalling the login shell to read a command file
cat >${CMDFILE?"not set"} < cd $1
PS1="\`pwd\`$ "
EOF
kill -${PROMPTSIG?"not set"} ${LOGIN_SHELL?"not set"}
Now change directories with "xcd /some/dir".