1 |
>>>>> On Wed, 21 Aug 2013, Micha³ Górny wrote: |
2 |
|
3 |
> elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then |
4 |
|
5 |
Thinking about it again, the pattern matching (already present in |
6 |
default_src_install of EAPI 4) is brittle and relies on the output |
7 |
of declare -p whose exact format is undocumented. |
8 |
|
9 |
Maybe we could change the test for an array to the following? |
10 |
|
11 |
elif ! declare +a DOCS &>/dev/null; then |
12 |
|
13 |
This seems to work fine in bash versions 3.2 and 4.2. And behaviour is |
14 |
well documented in the bash reference manual [1]: |
15 |
|
16 |
| Using `+' instead of `-' turns off the attribute instead, with the |
17 |
| exceptions that `+a' may not be used to destroy an array variable |
18 |
| [...] |
19 |
| |
20 |
| The return status is zero unless [...] an attempt is made to turn |
21 |
| off array status for an array variable, [...] |
22 |
|
23 |
Ulrich |
24 |
|
25 |
[1] http://www.gnu.org/software/bash/manual/bashref.html#Bash-Builtins |