Date: Tue, 21 May 2019 22:11:20 +0000
From: Charles-Henri Gros <[email protected]>
Message-ID:
<b51a83f93b459b479b6c4c3fbfe3f9310156f52...@us01wembx1.internal.synopsys.com>
| The existence or not of the file should not have any effect.
But it does, and is intended to. If the mattern matches a file
(when patyhname expanded as a result of the unquoted command substitution)
you get the file name produced. If it does not match a file,
the pattern is left untouched. That is the way that things are
supposed to work.
I suspect that you meant to say
for i in "$(echo "a\\\$.class")"; do echo "$i"; done
then there would be no pathname expansion happening (more correctly,
there still is, but the pathname to be expanded contains no magic
chars, only chars that match literally, so you either get the file
with the exact same name, or the pattern untouched, which is the same
thing - shells generally optimise away the attempt to match in that
case, as the result is always known in advance).
kre