[Toybox] One more bash corner case.
Chet Ramey
chet.ramey at case.edu
Mon Dec 16 08:04:42 PST 2024
On 12/16/24 4:26 AM, Rob Landley wrote:
> Aha: the "promptvars" option gratuitously expands PS1 _twice_:
Gratuitously? It performs a separate set of expansions from the
backslash-escape sequence decoding. People use it to add a little more
dynamism to prompting. Think about evaluating one of the bash dynamic
variables or, as you show, using command substitution.
>
> $ touch potato
> $ PS1='$(rm potato)' bash --noprofile --norc
> exit
> exit
> $ ls -l potato
> ls: cannot access 'potato': No such file or directory
>
> And you default it to on. Good to know.
It's always defaulted to on, Rob. For about 30 years now. Before that
variable existed, bash performed word expansions on PS1 unconditionally.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet at case.edu http://tiswww.cwru.edu/~chet/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20241216/6bb6929e/attachment.sig>
More information about the Toybox
mailing list