2 ms·
> Quoting inhibits both word splitting and wildcard expansion, for variables and command substitutions. The result of a variable substitution isn't subject to
by kazinator 9y ago
> Quoting inhibits both word splitting and wildcard expansion, for variables and command substitutions.
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.
- koala_man 9y agoIt is subject to wildcard expansion. You can verify this with var="/*"; echo $var
- Hello71 9y agowhat the balls are you talking about? $ 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.
- kazinator 9y agoIndeed; see https://news.ycombinator.com/item?id=17070872 https://news.ycombinator.com/item?id=17070872 I'd erase my hasty comment if I could. I'm just praying it gets downvoted to invisibility now.