Article View: gnu.bash.bug
Article #982Re: Bug of prompt \$
From: Chet Ramey
Date: Fri, 08 Jan 1993 04:16
Date: Fri, 08 Jan 1993 04:16
30 lines
1439 bytes
1439 bytes
> I am running bash 1.12 on SunOS 4.1.1. > In my .bashrc, PS1 set to ... > > PS1="[\h \t \W]\$ " > > but, not work \$ at su command.Same as root login. This assignment statement is not doing what you expect. Backslashes which precede dollar signs in double-quoted strings are removed during expansion. This is specified in Posix.2 and is the traditional sh behavior. Your PS1 is really being set to `[\h \t \W]$ '. If you change the double quotes to single quotes in the assignment statement, things will work as you expect: [odin 09:21:42 sun4]$ PS1='[\h \t \W]\$ ' [odin 09:21:50 sun4]$ export PS1 [odin 09:21:54 sun4]$ su Password: [odin 09:21:59 sun4]# [odin 09:22:12 sun4]# echo -"$PS1"- -[\h \t \W]\$ - Chet -- ``The use of history as therapy means the corruption of history as history.'' -- Arthur Schlesinger Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu
Technical Details
Message-ID:
<9301081416.AA04043.SM@odin.INS.CWRU.Edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!odin.ins.cwru.edu!chetReferences:
chet@odin.ins.cwru.edu (Chet Ramey)Show Full Headers
Complete Article Headers
Newsgroups: gnu.bash.bug Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!odin.ins.cwru.edu!chet From: chet@odin.ins.cwru.edu (Chet Ramey) Subject: Re: Bug of prompt \$ Message-ID: <9301081416.AA04043.SM@odin.INS.CWRU.Edu> Sender: gnulists@ai.mit.edu Reply-To: chet@po.cwru.edu Organization: GNUs Not Usenet References: chet@odin.ins.cwru.edu (Chet Ramey) Distribution: gnu Date: Fri, 8 Jan 1993 04:16:28 GMT Approved: bug-bash@prep.ai.mit.edu Lines: 31