help-bash
[Top][All Lists]
Advanced

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

Re: how to (safely) escape an arbitrary string for use in PS1


From: Chet Ramey
Subject: Re: how to (safely) escape an arbitrary string for use in PS1
Date: Mon, 24 May 2021 12:38:19 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.2

On 5/21/21 7:23 PM, Koichi Murase wrote:

- interestingly: [\$\`\'\"\] (i.e. not double-\ at the end ... does
   seem to be parsed, but doesn't match \ ... shouldn't that be a syntax
   error?

Backslashes don't have any special meaning inside bracket expressions, so
the bracket expression is properly terminated.


- Oh, this example is interesting. I guess [\$\`\'\"\] is treated as
[<quoted $`'"]> and "escaped" as [$`'"], but it's just a naive guess.

It's a pretty good guess, but the backslash is part of the bracket
expression, too.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]