Bourne Shell Question?

William E. Davidsen Jr davidsen at steinmetz.ge.com
Fri Feb 3 02:26:07 AEST 1989


In recent versions of sh you can use a function with a similar name to
do what you want.
	cwd() { cd $1 && PS1="`pwd`> "; }

In ksh you can use the $PWD, as:
	PS1='$PWD> '
or (my favorite) strip the HOME from the display with:
	PS1='${PWD#$HOME/}> '
This 2nd form strips the HOME part of the directory when you are in a
subdirectory of your HOME directory, and leaves a prompt starting with a
driectory name. In all other directories, including HOME, you get the
absolute path name, starting with a /.

Hope this isn't more info than you wanted.
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.questions mailing list