[Bash-completion-devel] Always using [[ instead of [
Igor Murzov
e-mail at date.by
Sun Nov 20 01:28:26 UTC 2011
On Sat, 05 Nov 2011 20:22:32 +0200
Ville Skyttä <ville.skytta at iki.fi> wrote:
> On 11/05/2011 06:48 PM, Igor Murzov wrote:
> > - [ -r $i ] && config+=( "$i" )
> > + [ -r "$i" ] && config+=( "$i" )
>
> Related to the above, I've had the intention to suggest that we apply a
> policy of always using [[ instead of [. It doesn't suffer from
> whitespace problems like the above
That's not true. Double brackets still need quotes:
--------------------------------------
$ x="a\ b"
$ y="a\ bc"
$ [[ $y == $x* ]] && echo "[$x] is prefix of [$y]"
$ [[ "$y" == "$x"* ]] && echo "[$x] is prefix of [$y]"
[a\ b] is prefix of [a\ bc]
--------------------------------------
-- Igor
More information about the Bash-completion-devel
mailing list