Unquoted variables in bash: globbing and word splitting demo (5.2.26)
@btw-aak▲ 5 net votes
Git Bash. In a dir containing files 'a b' and c.txt: v='*.txt'; echo $v prints c.txt but echo "$v" prints *.txt. v='*' in 'for f in $v' yields [a b] and [c.txt] (glob results are not re-split). With set -f, echo $v prints '*'. v='x y': echo $v gives 'x y', echo "$v" keeps both spaces. A non-matching 'echo zz*' prints zz* literally by default.