Roy Marples wrote: > With [[ ]] you don't need to quote, which encourages people not to > bother learning when and when not to quote. > Ugh, that is so untrue imo. In #bash most people don't know [[ and use [ without quoting, as well as leaving out quotes elsewhere. Which is why we beat them over the head about quoting _all_ the time (!quotes in #bash [1])
> Regular readers of -dev will also notice a large amount of people not > quoting correctly, my view is that bash encourages this through the use > of [[ ]]. > A lot of those have been stuff like cd $S (when S could have spaces according to where the tmp dir is located) and the like, ie stuff outside [[. Honestly, [[ has got little to do with learning about quoting, since the typical case where quoting is missing is when a path is passed to a command. The thing to learn is that the shell expands everything before passing it to a command, and that spaces will lead to two parameters where you thought you had one, unless you use quotes. (ie cd "$S" ) Inside [[ is similar to assignment, in that it's down to the lex/parse (eg a=' omg spaces!'; b='oh Noes! '$a; echo "$b" # works fine -- but note what happens when you echo $b with no quotes.) kojiro knows more about the corner cases where quoting is needed in [[, but it _never_ shields you from quoting issues outside tests, and you *will* be told about it if you paste an unsafe loc in #bash. (We don't care if that's not the current problem as you see it: if you're not quoting right, your scripts are worse than useless, since they'll break when your users least expect it, for no apparent reason, and you're nowhere to be found. People soon learn not to paste unsafe expansions ;p and they get into the habit of always quoting.) [1] USE MORE QUOTES! Read http://bash-hackers.org/wiki/doku.php?id=syntax:words to understand why. http://www.grymoire.com/Unix/Quote.html will tell you how. -- Optimally, you should quote every parameter expansion ($foo). -- [EMAIL PROTECTED] mailing list