Re: [50 character or so descriptive subject here (for reference)]
From:
Chet Ramey
Subject:
Re: [50 character or so descriptive subject here (for reference)]
Date:
Tue, 17 Oct 2000 15:13:16 -0400
> Machine Type: i686-pc-linux-gnu
>
> Bash Version: 2.03
> Patch Level: 0
> Release Status: release
>
> Description:
>
> The info file says that in the context of prompts:
>
> `\w'
> The current working directory.
>
> `\W' The basename of `$PWD'.
>
> However:
>
> bash # export PS1='\[\033[1;36m\]\h:\w#\[\033[0m\] '
> vermont:/ext2b/what\ the\ bloody\ hell\ is\ going\ on\ here# export
> PS1='\[\033[1;36m\]\h:\W#\[\033[0m\] '
I don't get this with bash-2.04, and, in fact, the CHANGES file for bash-2.04
says:
p. The prompt string decoding code now backslash-quotes only characters that
are special within double quotes when expanding the \w and \W escape
sequences.
These characters have to be quoted because the expanded value of the prompt
string is run through the shell word expander. Think about the consequences
if you cd'd into a directory whose name contained a naughty command between
backquotes.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/