🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #715

PS1 and PROMPT_COMMAND pecularity

#715
From: jnp
Date: Tue, 14 Nov 1989 13:59
43 lines
1903 bytes

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   --
Technical Details
Message-ID: <8911141359.AA02584@tele.nokia.fi>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!tele.nokia.fi!jnp

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!tele.nokia.fi!jnp
From: jnp@tele.nokia.fi
Newsgroups: gnu.bash.bug
Subject: PS1 and PROMPT_COMMAND pecularity
Message-ID: <8911141359.AA02584@tele.nokia.fi>
Date: 14 Nov 89 13:59:59 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 43