1 |
On 06/12/2016 02:02 AM, Benda Xu wrote: |
2 |
> Hi Ulrich, |
3 |
> |
4 |
> Ulrich Mueller <ulm@g.o> writes: |
5 |
> |
6 |
>>> I have added EPREFIX logics for EAPI<3 and improved the trailing |
7 |
>>> slashes and quotes. |
8 |
>> |
9 |
>>> - [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \ |
10 |
>>> + [[ -f "${EROOT}"usr/include/linux/autoconf.h ]] \ |
11 |
>> |
12 |
>> Inside [[ ]] quotes are generally not needed. (There are several other |
13 |
>> instances of this.) |
14 |
> |
15 |
> I thought so too, but with an experiment: |
16 |
> |
17 |
> bash --version |
18 |
> GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu) |
19 |
> |
20 |
> bash -l |
21 |
> $ [[ -f a b ]] && echo hi |
22 |
> bash: syntax error in conditional expression |
23 |
> bash: syntax error near `b' |
24 |
> $ [[ -f "a b" ]] && echo hi |
25 |
> hi |
26 |
> |
27 |
> So it seems that [[ ]] does need quotes. |
28 |
|
29 |
However, it behaves differently when you have a variable with "a b" as |
30 |
its content. |
31 |
|
32 |
foo="a b" |
33 |
[[ -f ${foo} ]] && echo hi |
34 |
-- |
35 |
Thanks, |
36 |
Zac |