[gnu.bash.bug] PS1 and PROMPT_COMMAND pecularity

jnp@tele.nokia.fi (11/14/89)

I have just upgraded from bash-1.01 to bash-1.03. In general better.
(Machine: Apollo DN3500, SR10.1/BSD4.3, native cc)

Though under bash-1.01 I had the inconvenience that
PROMPT_COMMAND was a little (one 'return' to be precise) delayed.

Example:
> bash$
< <return>
> host:~/ (1) 
< cd tmp
> host:~/ (1)
< <return>

(">" is output from bash, "<" is my input, "<return>" is 'hit return' )

with the following (excerpt) from ~/.profile) and "bash -login":

> declare -x HOST=`hostname`
> set_prompt() { PWD=`pwd`; PS1="$HOST:`echo $PWD | sed -e s%$HOME%~%` (\#) "; export PS1; }
> declare -x PROMPT_COMMAND=set_prompt

With version 1.03 I get the prompt correct immediately. But (spoiler)
when cd'ing, pushd'ing, popd'ing I get the value of one of two
shell variables. If I go to a sub-directory I get (on screen) the value of
one variable. On dc'ing back (or popd'ing) I get the value of another - and
I can do nothing but hit return (example):

  > tnds01:~ (24) cd /usr/local/src/patch
  > SHLVL=2
  > tnds01:/usr/local/src/patch (25) cd ..
  > tnds01:/usr/local/src (26) cd ~/src/c
  > tnds01:~/src/c (27) cd ~/
  > PAGER=/usr/local/bin/less
  > tnds01:~ (28)


------------------------ ORIGIN  '~jnp/stdDisclaimers' ------------------------
| Regards, J|rgen N|rgaard ('|' is '\o{}' in \LaTeX{})                        |
|    e-mail: jnp@tele.nokia.fi | telephone: <..>-358-0-511-5671               |
--    mail: Nokia Telecommunications, PL 33, SF-02601 Espoo, Suomi Finland   --

chet@cwns1.CWRU.EDU (Chet Ramey) (11/28/89)

In article <8911141359.AA02584@tele.nokia.fi> jnp@tele.nokia.fi writes:

		 declare -x HOST=`hostname`
		 set_prompt() { PWD=`pwd`; PS1="$HOST:`echo $PWD | sed -e s%$HOME%~%` (\#) "; export PS1; }
		 declare -x PROMPT_COMMAND=set_prompt

	With version 1.03 I get the prompt correct immediately. But (spoiler)
	when cd'ing, pushd'ing, popd'ing I get the value of one of two
	shell variables. If I go to a sub-directory I get (on screen) the value of
	one variable. On dc'ing back (or popd'ing) I get the value of another - and
	I can do nothing but hit return (example):
	
	  	 tnds01:~ (24) cd /usr/local/src/patch
	  	 SHLVL=2
	  	 tnds01:/usr/local/src/patch (25) cd ..
	  	 tnds01:/usr/local/src (26) cd ~/src/c
	  	 tnds01:~/src/c (27) cd ~/
	  	 PAGER=/usr/local/bin/less
	  	 tnds01:~ (28)

I have sent a fix for this to Brian.

Chet Ramey
-- 
Chet Ramey
Network Services Group				"Where's my froggie?"
Case Western Reserve University
chet@ins.CWRU.Edu