On Mon, Jun 1, 2026 at 6:07 PM Chet Ramey <[email protected]> wrote: > > On 5/31/26 10:32 AM, Andreas Schwab 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. > > The rationale in the POSIX standard (yes, I realize it's not normative) says: > > "Patterns are matched against existing filenames and pathnames only when > the pattern contains a '*', '?' or '[' character that will be treated as > special. This prevents accidental removal of <backslash> characters in > variable expansions where generating a list of matching files is not > intended and a (usually oddly named) file with a matching name happens to > exist." > > https://pubs.opengroup.org/onlinepubs/9799919799/xrat/V4_xcu_chap01.html#tag_23_02_14_04 >
I see. Thank you! Sorry for the noise.
