Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: RFC: kernel-2.eclass Prefix support
Date: Sun, 12 Jun 2016 09:30:09
Message-Id: 22365.11157.334642.260008@a1i15.kph.uni-mainz.de
In Reply to: Re: [gentoo-dev] Re: RFC: kernel-2.eclass Prefix support by Benda Xu
1 >>>>> On Sun, 12 Jun 2016, Benda Xu wrote:
2
3 >> Inside [[ ]] quotes are generally not needed. (There are several other
4 >> instances of this.)
5
6 > I thought so too, but with an experiment:
7
8 > bash --version
9 > GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
10
11 > bash -l
12 > $ [[ -f a b ]] && echo hi
13 > bash: syntax error in conditional expression
14 > bash: syntax error near `b'
15 > $ [[ -f "a b" ]] && echo hi
16 > hi
17
18 Wrong experiment, so you get wrong results. :)
19
20 $ foo="a b"
21 $ [[ -f ${foo} ]] && echo yes || echo no
22 no
23 $ touch "a b"
24 $ [[ -f ${foo} ]] && echo yes || echo no
25 yes
26
27 > So it seems that [[ ]] does need quotes.
28
29 I doesn't around a variable.
30
31 Ulrich