On Sun, May 31, 2026 at 5:32 PM Andreas Schwab <[email protected]> wrote:
>
> On Mai 31 2026, Andrei Borzenkov wrote:
>
> > $ bar='\*'
> > $ ls $bar
> > ls: cannot access '\*': No such file or directory
> > $
> >
> > Oops. Why it suddenly attempts to match *two* characters "\*" instead of
> > just one literal "*"?
>
> Because '\*' is not a glob, so filename expansion is not performed.
>

If this is not a glob, I expect '\' to be stripped (quote removal)
before the result is used in the command.

bash is using unquoted_glob_pattern_p () to check "if STRING has any
unquoted special globbing chars in it". This function treats both
CTLESC and
'\' as quote characters. But subsequent dequote_string () only removes
CTLESC leaving '\' in place.

Reply via email to