This workaround should work for your problems:
----------------------------------------------
- Remove all lines from your .bashrc, /etc/bashrc,
/etc/profile that set PS1 or PROMPT_COMMAND.
- Put these lines in your .bashrc:
PS1='$MY_PS1'
export MY_PS1
The quoting is important here.
- Verify that the promtvars bash option is set with
shopt promptvars
If not, put this line in your .bashrc:
shopt -s promptvars
- Now whenever you would have set PS1, set MY_PS1 instead.
You will have to change all your scripts, but at least
this works.
Background:
-----------
1) Unlike most (probably all) other shells, bash *deletes*
the contents of PS1 if it is non-interactive (i.e. if
you run a script with bash). This is documented
behaviour however.
2) Under Linux, /bin/sh is a link to bash.
3) The startx, xinitrc and xserverrc use /bin/sh = bash as
their executing shell and fvwm (and probably twm) execute
commands with /bin/sh.
4) When you start X11 with startx, the startx script strips
the contents of PS1. If you use xserverrc or xinitrc they
do the same as does fvwm.
What you should do:
-------------------
Write a bug report to the bash developers. It may be a good
idea to not set PS1 to the default in a non-interactive bash,
but deleting an already set PS1 is a bad idea. Nobody has
noticed before because nearly everyone sets the prompt in
some configuration file. The effect is that when a non-interactive
bash starts a new interactive bash, the new shell does not get
the exported prompt. I have tested tcsh, zsh and pdksh on my
Linux, and all of these work well.
The 'bug' or feature (remember it is documented on the manpage)
can be verified with the following command:
echo 'echo PS1 = $PS1' | bash
The reasons to change this are:
- No noteworthy gain by deleting PS1 this saves only a few
bytes.
- Better compatibility with other shells (ksh and probably
posix sh)
If there are problems to communicate this bug to the bash
developers, please contact me again and I will explain it
in detail. I do not want to make the report myself since
I have no time for that if it is not necessary.
Bye
Dominik
--
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, dominik_vogt_at_hp.com
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Mon Nov 02 1998 - 06:29:54 GMT