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    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to