On 06/12/2016 02:02 AM, Benda Xu wrote:
> Hi Ulrich,
>
> Ulrich Mueller <[email protected]> writes:
>
>>> I have added EPREFIX logics for EAPI<3 and improved the trailing
>>> slashes and quotes.
>>
>>> - [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \
>>> + [[ -f "${EROOT}"usr/include/linux/autoconf.h ]] \
>>
>> Inside [[ ]] quotes are generally not needed. (There are several other
>> instances of this.)
>
> I thought so too, but with an experiment:
>
> bash --version
> GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu)
>
> bash -l
> $ [[ -f a b ]] && echo hi
> bash: syntax error in conditional expression
> bash: syntax error near `b'
> $ [[ -f "a b" ]] && echo hi
> hi
>
> So it seems that [[ ]] does need quotes.
However, it behaves differently when you have a variable with "a b" as
its content.
foo="a b"
[[ -f ${foo} ]] && echo hi
--
Thanks,
Zac