cd $1
PS1="\`pwd\`$ "
EOF
kill -${PROMPTSIG?"not set"} ${LOGIN_SHELL?"not set"}
Now change directories with "xcd /some/dir".
Korn Shell (ksh):
Put this in your .profile file:
PS1='$PWD $ '
If you just want the last component of the directory, use
PS1='${PWD##*/} $ '
T C shell (tcsh)
Tcsh is a popular enhanced version of csh with some extra
builtin variables (and many other features):
%~ the current directory, using ~ for $HOME
%/ the full pathname of the current directory
%c or %. the trailing component of the current directory
so you can do
set prompt='%~ '
BASH (FSF's "Bourne Again SHell")
\w in $PS1 gives the full pathname of the current directory,
with ~ expansion for $HOME; \W gives the basename of
the current directory. So, in addition to the above sh and
ksh solutions, you could use
PS1='\w $ '
or
PS1='\W $ '