On 7/12/18 7:38 PM, jeremy.richa...@ngc.com wrote:
> Bash Version: 4.2
> Patch Level: 46
> Release Status: release
>
> Description:
> I noticed some strange behavior in the DIRSTACK variable (used in
> pushd/popd).
> `declare -p DIRSTACK`
> shows the list of current directories on t
On 7/17/18 4:03 AM, sunhui...@unionpay.com wrote:
> Hi:
>I found the orginal bash_syslog_history has three flaws:
> 1、 Ingore the texts that length exceed SYSLOG_MAXLEN,however in our
> environment ,we have a lot of db2 command line which exceed SYSLOG_MAXLEN;
> 2、only get PID an
$ echo $BASH_VERSION
4.4.23(1)-release
$ f() { declare -a a; declare -A a; declare -p a; }; f
bash: declare: a: cannot convert indexed to associative array
declare -aA a
Segmentation fault: 11
This behavior is still present in the devel branch.
The following commands:
declare -n r=v[0]
v=(X); r=Y
declare -p ${!v*}
printf "%s: <%s>\n" "r" "$r" "v" "$v"
Will normally produce the following output:
declare -a v=([0]="Y")
r:
v:
However, if we start bash with `v[0]' already in the environment, such as with:
Usually, an assignment preceding a command that would create a
variable with an invalid name is rejected and treated like a command
name:
$ 1=X :
bash: 1=X: command not found
But when the variable name looks (sort of) like an array subscript
assignment, it is accepted and an oddly named variable
On 7/17/18 1:55 PM, Grisha Levit wrote:
> $ echo $BASH_VERSION
> 4.4.23(1)-release
> $ f() { declare -a a; declare -A a; declare -p a; }; f
> bash: declare: a: cannot convert indexed to associative array
> declare -aA a
> Segmentation fault: 11
>
> This behavior is still present in the devel branc
When there is a variable with a name that includes a subscript in the
environment, test -v looks at that variable rather than an array with
that subscript.
I just posted about two ways [1] [2] to create variables like
`var[0]=X' and if both of those methods are fixed than this report
might be moot
At global scope this works as expected:
$ declare -n ref=var; declare -a ref=(X); declare -p ref var
declare -n ref="var"
declare -a var=([0]="X")
But in a function, we end up with the nameref variable having both the
`a' and `n' attributes and nothing in the target:
$ f() { declare -n ref=var;