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

Re: Wrong interpretation og '\$' by bash?



On Sun, 2004-08-22 at 01:52, Nicholas Lativy wrote:
> >     PS1="\[\033]0;\$\w/\007\]\$\w/: "
> 
> I tried this here and got the same as you report, a "$" for root
> instead of the expected "#". Then I used:
> 
>     PS1='\[\033]0;\$\w/\007\]\$\w/: '
> 
> and that worked! I played about a bit and consistently the latter
> quoting style produced the expected result but the former did not. I
> have no idea why this is (a bug?)

It is a consequence of shell quoting rules.  "..." does variable
substitution and backslash escaping, '...' does no substitution or
escaping.

-- 
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "For yourselves know perfectly that the day of the Lord
      so cometh as a thief in the night. For when they shall
      say, Peace and safety; then sudden destruction cometh 
      upon them, as travail upon a woman with child; and 
      they shall not escape."      I Thessalonians 5:2,3 



Reply to: