by kazinator · 8y ago · 0 comments
The result of a variable substitution isn't subject to wilcard expansion, whether quoted or not.
If your only reason to quote "$foo" is because you think foo expands to a globbing pattern, and no other reason is justified, you can drop the quotes.
var="/*"; echo $var $ touch bad; a='*'; echo $a
bad
I tested with shbot and this is the case in at least original bourne sh, ksh, mksh, dash, bash 1, and bash 4.4.I'd erase my hasty comment if I could. I'm just praying it gets downvoted to invisibility now.