Re: path in shell "JJ" wrote:
> Been years since I have had to deal with AIX (4.3), I recall there
> was a simple way for the current 'path' to show whenever at a
> #shell prompt - was a parameter somewhere - any help? Do you need
> to reboot AIX for it to take affect?
You don't say what login shell. You might try comp.unix.shell for other
(or better) answers. If you're using ksh, simply:
PS1='${PWD}> '
Note that those are single quotes, not backtics.
The trouble with using the whole path is that you will sometimes run out
of screen to display it. here's a function to put in your .kshrc (if
you use one, or in $FPATH if you use that) to dynamically change how much
of the directory you see.
To set your prompt to the last three nodes of the directory, just type
"prompt 3". To change it back to full, just type "prompt".
If you don't want to see the userid or machine, you can take those out
by removing everything in the square braces.
function prompt {
case $# in
0) set 6 ;;
esac
case $1 in
1) PS1='[${LOGNAME##}@'`uname -n`'] ${PWD#${PWD%/*}/}> ' ;;
2) PS1='[${LOGNAME##}@'`uname -n`'] ${PWD#${PWD%/*/*}/}> ' ;;
3) PS1='[${LOGNAME##}@'`uname -n`'] ${PWD#${PWD%/*/*/*}/}> ' ;;
4) PS1='[${LOGNAME##}@'`uname -n`'] ${PWD#${PWD%/*/*/*/*}/}> ' ;;
5) PS1='[${LOGNAME##}@'`uname -n`'] ${PWD#${PWD%/*/*/*/*/*}/}> ' ;;
*) print "defaulting to full path"
PS1='[${LOGNAME##}@'`uname -n`'] ${PWD}> ' ;;
esac
} |