[gnu.bash.bug] Bash: unwanted misfeature; wanted features

karney%SS01.PPPL.GOV@CCC.NMFECC.GOV (Charles Karney) (02/28/90)

bash 1.04, Sun OS 4.0.3, SPARCstation, gcc-compiled...

My home directory is /u/karney.  This is a symbolic link to /usr1/karney.
/etc/passwd lists my shell as /bin/bash.  When I log in, PWD is
/usr1/karney.  I think it should be /u/karney.  Similarly whenever I create
a new subshell the links are followed (effectively making PWD=`pwd`).

Next two features are suggested by tcsh:

I'd like to be able to specify a command to be run on every cd, pushd,
popd.  (So I can put the current directory into the title of my xterm
window.)

I'd like pushd +n to rotate the top n+1 elements of dirs by 1.  (Currently
it rotates all the elements by -n.)  That way useless directories migrate
to the end of dirs.

   Charles Karney
   Plasma Physics Laboratory	  E-mail:  Karney@ccc.nmfecc.gov
   Princeton University		  Phone:   +1 609 243 2607
   Princeton, NJ 08543-0451	  FAX:	   +1 609 243 2160

bfox@sbphy.ai.mit.edu (Brian Fox) (02/28/90)

   Date: Tue, 27 Feb 90 15:48:45 EST
   From: karney%SS01.PPPL.GOV@ccc.nmfecc.gov (Charles Karney)
   Reply-To: Karney@ccc.nmfecc.gov

   I'd like to be able to specify a command to be run on every cd, pushd,
   popd.  (So I can put the current directory into the title of my xterm
   window.)


In my .bashrc:

xtitle () { echo -n -e "\033]l$*\033" }
function cd_xtitle () { 
   if [ "$cd_xtitle_pwd" != "$PWD" ]; then
      if [ -z "$tty" ]; then tty=`tty | sed -e s:/dev/ttyp::`; fi
      xtitle "$HOST:$PWD (${tty})"
      cd_xtitle_pwd=$PWD
   fi
}

case $TERM in
   xterm | hpterm)
     PROMPT_COMMAND=cd_xtitle
   ;;
esac