Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a

2020-02-20 Thread Arfrever Frehtes Taifersar Arahesis
2020-02-20 21:36 GMT+01:00, Chet Ramey : > On 2/19/20 4:03 PM, Arfrever Frehtes Taifersar Arahesis wrote: >> ${!variable@operator} does not work for variables without values. >> See empty values for all occurrences of ${!var@...} below. >> >> ${variable@A} does no

Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a

2020-02-20 Thread Arfrever Frehtes Taifersar Arahesis
Chet Ramey 2020-02-20 21:22 UTC: > On 2/19/20 7:46 PM, Arfrever Frehtes Taifersar Arahesis wrote: >> But I am not interested in any ${!varname[@]}, but instead in applying >> @operator transformations. > > OK, let's see how these work. > > Given the following &

Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a

2020-02-20 Thread Arfrever Frehtes Taifersar Arahesis
Chet Ramey 2020-02-20 20:41 UTC: > On 2/19/20 5:22 PM, Arfrever Frehtes Taifersar Arahesis wrote: >>> ${variable@A} does not work for scalar variables without values, but >>> interestingly ${variable[@]@A} works for them. >> >> More precisely, ${variable[@]

Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a

2020-02-19 Thread Arfrever Frehtes Taifersar Arahesis
ot;あ" [1]="い" [2]="う" [3]="え" [4]="お") $ eval "echo \"\${${REF}[@]@a}\"" a a a a a $ echo "${ARRAY[@]@A}" declare -a ARRAY=([0]="あ" [1]="い" [2]="う" [3]="え" [4]="お") $ echo "${ARRAY[@]@a}" a a a a a $ Majority (3 of 4) of bugs reported by me in this thread are unaffected by above discussion about ${!...} and are certainly still valid. -- Arfrever Frehtes Taifersar Arahesis

Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a

2020-02-19 Thread Arfrever Frehtes Taifersar Arahesis
VAR6[@]@P}: 'zzz' var=VAR1 ${!var@A}:'' ${!var[@]@A}: '' ${VAR1@A}:'' ${VAR1[@]@A}: 'declare -rl VAR1=''' var=VAR2 ${!var@A}:'declare -rl VAR2='zzz'' ${!var[@]@A}: 'declare -rl VAR2='zzz'' ${VAR2@A}:'declare -rl VAR2='zzz'' ${VAR2[@]@A}: 'declare -rl VAR2='zzz'' var=VAR3 ${!var@A}:'' ${!var[@]@A}: '' ${VAR3@A}:'' ${VAR3[@]@A}: '' var=VAR4 ${!var@A}:'declare -arl VAR4='zzz'' ${!var[@]@A}: 'declare -arl VAR4='zzz'' ${VAR4@A}:'declare -arl VAR4='zzz'' ${VAR4[@]@A}: 'declare -arl VAR4=([0]="zzz")' var=VAR5 ${!var@A}:'' ${!var[@]@A}: '' ${VAR5@A}:'' ${VAR5[@]@A}: '' var=VAR6 ${!var@A}:'declare -Arl VAR6='zzz'' ${!var[@]@A}: 'declare -Arl VAR6='zzz'' ${VAR6@A}:'declare -Arl VAR6='zzz'' ${VAR6[@]@A}: 'declare -Arl VAR6=([0]="zzz" )' var=VAR1 ${!var@a}:'' ${!var[@]@a}: '' ${VAR1@a}:'rl' ${VAR1[@]@a}: 'rl' var=VAR2 ${!var@a}:'rl' ${!var[@]@a}: 'rl' ${VAR2@a}:'rl' ${VAR2[@]@a}: 'rl' var=VAR3 ${!var@a}:'' ${!var[@]@a}: '' ${VAR3@a}:'arl' ${VAR3[@]@a}: '' var=VAR4 ${!var@a}:'arl' ${!var[@]@a}: 'arl' ${VAR4@a}:'arl' ${VAR4[@]@a}: 'arl' var=VAR5 ${!var@a}:'' ${!var[@]@a}: '' ${VAR5@a}:'Arl' ${VAR5[@]@a}: '' var=VAR6 ${!var@a}:'Arl' ${!var[@]@a}: 'Arl' ${VAR6@a}:'Arl' ${VAR6[@]@a}: 'Arl' $ -- Arfrever Frehtes Taifersar Arahesis

Re: ${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a

2020-02-19 Thread Arfrever Frehtes Taifersar Arahesis
1=''" But should be: declare -rl VAR1 As in output of 'declare -p VAR1'. -- Arfrever Frehtes Taifersar Arahesis

Unnecessary space in 'declare -p' and [@]@A for non-empty associative arrays

2020-02-19 Thread Arfrever Frehtes Taifersar Arahesis
quot; declare -a VAR3=([0]="a" [1]="b") $ echo "${VAR4[@]@A}" declare -A VAR4=() $ echo "${VAR5[@]@A}" declare -A VAR5=([0]="a" ) $ echo "${VAR6[@]@A}" declare -A VAR6=([1]="b" [0]="a" ) $ (BASH 5.0.16) -- Arfrever Frehtes Taifersar Arahesis

${!variable@operator} does not work for variables without values; inconsistencies between present and absent [@] for @A and @a

2020-02-19 Thread Arfrever Frehtes Taifersar Arahesis
;' var=VAR2 ${!var@A}:'' ${!var[@]@A}: '' ${VAR2@A}: 'declare -rl VAR2='zzz'' ${VAR2[@]@A}: 'declare -rl VAR2='zzz'' var=VAR3 ${!var@A}:'' ${!var[@]@A}: '' ${VAR3@A}:'' ${VAR3[@]@A}: '' var=VAR4 ${!var@A}:'' ${!var[@]@A}: '' ${VAR4@A}:'declare -arl VAR4='zzz'' ${VAR4[@]@A}: 'declare -arl VAR4=([0]="zzz")' var=VAR5 ${!var@A}:'' ${!var[@]@A}: '' ${VAR5@A}:'' ${VAR5[@]@A}: '' var=VAR6 ${!var@A}:'' ${!var[@]@A}: '' ${VAR6@A}:'declare -Arl VAR6='zzz'' ${VAR6[@]@A}: 'declare -Arl VAR6=([0]="zzz" )' var=VAR1 ${!var@a}:'' ${!var[@]@a}: '' ${VAR1@a}:'rl' ${VAR1[@]@a}: 'rl' var=VAR2 ${!var@a}:'' ${!var[@]@a}: '' ${VAR2@a}:'rl' ${VAR2[@]@a}: 'rl' var=VAR3 ${!var@a}:'' ${!var[@]@a}: '' ${VAR3@a}:'arl' ${VAR3[@]@a}: '' var=VAR4 ${!var@a}:'' ${!var[@]@a}: '' ${VAR4@a}:'arl' ${VAR4[@]@a}: 'arl' var=VAR5 ${!var@a}:'' ${!var[@]@a}: '' ${VAR5@a}:'Arl' ${VAR5[@]@a}: '' var=VAR6 ${!var@a}:'' ${!var[@]@a}: '' ${VAR6@a}:'Arl' ${VAR6[@]@a}: 'Arl' $ -- Arfrever Frehtes Taifersar Arahesis

Inconsistent termination of function when 'local' tries to override read-only variable

2020-02-19 Thread Arfrever Frehtes Taifersar Arahesis
: VAR2: readonly variable $ f() { VAR3= ; echo AAA ; } ; f bash: VAR3: readonly variable $ -- Arfrever Frehtes Taifersar Arahesis

${variable@A} does not work for associative arrays

2020-02-19 Thread Arfrever Frehtes Taifersar Arahesis
BASH 5.0.16. $ VAR1=aaa $ declare -a VAR2=(aaa) $ declare -A VAR3=([aaa]=aaa) $ declare -p VAR{1,2,3} declare -- VAR1="aaa" declare -a VAR2=([0]="aaa") declare -A VAR3=([aaa]="aaa" ) $ echo "${VAR1@A}" VAR1='aaa' $ echo "${VAR2@A}" decl

Assignments to FUNCNAME break FUNCNAME

2014-11-28 Thread Arfrever Frehtes Taifersar Arahesis
quot;B" [1]="A" [2]="A" [3]="A")' $ A A declare -a FUNCNAME='([0]="A" [1]="A" [2]="A" [3]="A")' $ B B declare -a FUNCNAME='([0]="B" [1]="A" [2]="A" [3]="A" [4]="A")' $ Also is it intentional that code after attempt of assignment to FUNCNAME is not run? The sentence in manual could be interpreted as simply setting $? to non-zero value and still running subsequent code. $ A() { echo A; local FUNCNAME=(); echo AAA; } $ A A bash: FUNCNAME: variable may not be assigned value $ -- Arfrever Frehtes Taifersar Arahesis signature.asc Description: This is a digitally signed message part.

Re: REGRESSION: shellshock patch rejects valid function names

2014-09-27 Thread Arfrever Frehtes Taifersar Arahesis
2014-09-27 23:12 Eric Blake napisał(a): > On 09/27/2014 02:57 PM, Arfrever Frehtes Taifersar Arahesis wrote: > > 2014-09-27 22:29 Eric Blake napisał(a): > >> Thankfully, bash already forbids trying to name a function 'a=b' > > > > It works in bash 4.

Re: REGRESSION: shellshock patch rejects valid function names

2014-09-27 Thread Arfrever Frehtes Taifersar Arahesis
2014-09-27 22:29 Eric Blake napisał(a): > Thankfully, bash already forbids trying to name a function 'a=b' It works in bash 4.3.26: $ function a=b() { echo A; } $ "a=b" A $ a\=b A -- Arfrever Frehtes Taifersar Arahesis signature.asc Description: This is a digitally signed message part.

Re: 'local -x VARIABLE' does not clear variable for subprocesses

2014-05-05 Thread Arfrever Frehtes Taifersar Arahesis
lare: VAR1: not found bash: declare: VAR2: not found bash: declare: VAR3: not found bash: declare: VAR4: not found ### Non-subshell subprocess: declare -x VAR1="aaa" declare -x VAR2="aaa" declare -x VAR3="aaa" declare -x VAR4="aaa" $ bash -c 'declare -p VAR{1,2,3,4}' declare -x VAR1="aaa" declare -x VAR2="aaa" declare -x VAR3="aaa" declare -x VAR4="aaa" 'declare +x' (or 'local +x') fails to unexport a variable when called in a function (both bash 4.2 and 4.3): $ export VAR=abc $ f() { declare +x VAR; bash -c 'declare -p VAR'; } $ f declare -x VAR="abc" $ declare +x VAR $ bash -c 'declare -p VAR' bash: line 0: declare: VAR: not found -- Arfrever Frehtes Taifersar Arahesis signature.asc Description: This is a digitally signed message part.

Re: 'local -x VARIABLE' does not clear variable for subprocesses

2014-05-05 Thread Arfrever Frehtes Taifersar Arahesis
2014-05-05 17:18 Chet Ramey napisał(a): > On 5/3/14, 7:22 PM, Arfrever Frehtes Taifersar Arahesis wrote: > > 'local -x VARIABLE' (without assignment of value) does not clear variable > > for subprocesses. > > It is regression in bash 4.3. > > It's not ac

'local -x VARIABLE' does not clear variable for subprocesses

2014-05-03 Thread Arfrever Frehtes Taifersar Arahesis
clare -x VAR1="abc" declare -x VAR2="abc" -- Arfrever Frehtes Taifersar Arahesis signature.asc Description: This is a digitally signed message part.

'declare +a -g' destroys local arrays

2013-08-22 Thread Arfrever Frehtes Taifersar Arahesis
Y: not found $ ARRAY=(x y z) $ f declare -a ARRAY='([0]="a" [1]="b" [2]="c")' bash: declare: ARRAY: cannot destroy array variables in this way declare -a ARRAY='([0]="a" [1]="b" [2]="c")' -- Arfrever Frehtes Taifersar Arahesis signature.asc Description: This is a digitally signed message part.

Subsequent `declare -fp` and `.` incorrectly restore function with here string with pattern substitution

2010-01-24 Thread Arfrever Frehtes Taifersar Arahesis
.` incorrectly restore function with here string with pattern substitution. Repeat-By: The following function is incorrectly restored: here_string_test() { : <<< "${var// /$'\n'}" } Run the attached bash_test.sh script u