Because the string [global]
is treated by the shell as a glob pattern and attempts to match any files in the current directory that have a single-character name from the set of characters {a, b, g, l, o}
. You have two files in that directory named a
and b
respectively. If you want [global]
to be treated as a string, then add some quotes:
for i in "[global]"
do
echo "$i"
done
Quoting prevents globbing.