[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash/Sh incompatibilty



> The question is somewhat off topic, but someone might know reference:
> 
> I set
> 
> export PS1='abc '
> 
> Then I start xterm and I get a bash with the same prompt.
> 
> When I do it via a script
> 
>  #!/bin/bash
>  xterm

This is a new invocation of bash, so bash resets PS1 appropriately:
this is a non-interactive shell (a script), so bash unsets PS1.  Then
the xterm starts, using an interactive shell, so bash sets PS1 to its
default value.  You need to change PS1 in .bashrc and/or .bash_profile
if you want it to change on new shell invocations.  (But whatever you
do, *don't* set it on non-interactive shells!)

   Julian

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

  Julian Gilbey, Dept of Maths, QMW, Univ. of London. J.D.Gilbey@qmw.ac.uk
             Debian GNU/Linux Developer.  jdg@debian.org
       -*- Finger jdg@master.debian.org for my PGP public key. -*-


Reply to: