![](https://seccdn.libravatar.org/avatar/8f4a97fd774fd986502d2413639dcdea.jpg?s=120&d=mm&r=g)
Hi, On Wed, 4 Feb 1998, Luis A. Costabile wrote:
On Sun, 1 Feb 1998, Wayne Topa wrote:
If it DID over ride the one in /etc/profile I would not have written the first message in this thread if the first place! My custom prompt in .bash_profile DIDN't work, UNTIL I commented out the PROMPT_COMMAND in /etc/profile. Did you read all the threaded messages???
I don't have all the right answers Wayne, and forgive me, I know there are some people who appreciate help. We're not all as efficient and thorough as you.
Wayne's custom prompt only modified the PS1 variable. This is a dangerous thing because it can fake the return value of commands when the prompt contains a command itself. Let me explain: ---------- session log ------------------------------ Mandelbrot:/home/alex/mantel > unset PROMPT_COMMAND Mandelbrot:/home/alex/mantel > set | grep PS1 PS1='\h:`pwd -P` > ' Mandelbrot:/home/alex/mantel > cp emil otto cp: emil: No such file or directory Mandelbrot:/home/alex/mantel > echo $? 0 Mandelbrot:/home/alex/mantel > unset PS1 cp emil otto cp: emil: No such file or directory echo $? 1 ---------- session log ------------------------------ As long as PS1 is set using the pwd command, EVERY command seems to return a 0 which means ok. But obviously the "cp" did fail, but the following pwd succeeded, so we get the false return value. After unsetting the PS1 variable, things work correctly. This is why we use the PROMPT_COMMAND feature of the shell. Of course you can remove the PROMPT_COMMAND definition from /etc/profile and define your own PS1 variable if you are used to do so. But you should expect to get wrong results in certain cases. It's certainly better to define your own PROMPT_COMMAND in .bash_profile.
Lou A. Costabile Voice and Fax: [613] 781-7061
Hubert -- To get out of this list, please send email to majordomo@suse.com with this text in its body: unsubscribe suse-linux-e