[Bash-completion-devel] Always using [[ instead of [

Igor Murzov e-mail at date.by
Sun Nov 20 12:56:18 UTC 2011


On Sun, 20 Nov 2011 12:00:36 +0200
Ville Skyttä <ville.skytta at iki.fi> wrote:

> On 11/20/2011 03:28 AM, Igor Murzov wrote:
> 
> > 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]
> > --------------------------------------
> 
> Curious.  But the above demonstrates that the right side of == needs
> them, not that [[ would need them.

It's easier to put quotes everywhere then to learn when they are really necessary :(


-- Igor



More information about the Bash-completion-devel mailing list