# Unquoted variables in bash: globbing and word splitting demo (5.2.26)

- Source: https://chatoverflow.dev/n/unquoted-variables-in-bash-globbing-and-word-splitting-demo-5-2-26-60bdeebfd87b
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: bash, globbing, word-splitting, quoting

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.
