bash 4.3 and 4.2 trouble with associative arrays assigned by ``printf -v''

2013-11-21 Thread NBaH

hello,

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/home/nbah/share/locale' 
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DDEBUG -DMALLOC_DEBUG -I.  -I. 
-I./include -I./lib   -g -O2
uname output: Linux mymachine 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 
x86_64 GNU/Linux

Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 0
Release Status: beta2

Description:
associative indexes don't appear when assigned by ``printf -v''
$ declare -A aa
$ printf -v "aa["ind1"]" "value 1"
$ printf -v "aa["ind2"]" "value 2"
$ printf '%s\n' "${!aa[@]}"

$

also :
Bash Version: 4.2
Patch Level: 37
Release Status: release
empty value in associative array when assigned by ``printf -v'' don't 
"assign" index

$ declare -A aa
$ printf -v "aa["ind1"]" "value 1"
$ printf -v "aa["ind2"]" ""
$ printf '%s\n' "${!aa[@]}"
ind1
$


Re: bash 4.3 and 4.2 trouble with associative arrays assigned by ``printf -v''

2013-11-26 Thread NBaH
Le 26/11/2013 14:59, dnade@orange.com a écrit :> For the record, in 
bash 4.2.25 (Ubuntu LTS 12.04) you can work around your issue with :

>
> printf -v "aa["ind2"]" %s ""
>
> or
>
> printf -v "aa["ind2"]" %s
>

hi,

right!
as I had to deal with variables expanding to things like '\x3C', '%s' 
didn't work.

I tried '%b', and now I can see empty values.

thank you.



`test -R' not working

2014-02-28 Thread NBaH

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Rompilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/home/nbah/share/locale' 
-DPACKAGE='bash'

+-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux diocletien 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 
x86_64 GNU/Linux

Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 0
Release Status: release

Description:

$ var="foo bar"
$ declare -n nameref=var
$ echo "${!nameref} = $nameref"
var = foo bar
$ test -R nameref && echo ok || echo ko
bash: test: -R: unary operator expected
ko


Repeat-By:

$ test -R "nameref" && echo ok || echo ko
bash: test: -R: unary operator expected
ko



I hope I don't miss anything.

TIA


Re: `test -R' not working

2014-03-01 Thread NBaH

Le 01/03/2014 03:26, Chet Ramey a écrit :


Thanks for the report.  A line got dropped from a merge back during
development.  I've attached a patch that fixes this and one other problem
with -R.

Chet



it works now.

thank you.


brace expansion fails in 4.3, succeed in 4.2

2014-05-10 Thread NBaH


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/home/nbah/share/locale' 
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib 
  -g -O2
uname output: Linux myOwnMachine 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3 
x86_64 GNU/Linux

Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 11
Release Status: release

Description:

bash-4.2 $ printf "%s " "$(date -d -"{0..9}"days +%Y%m%d)"
20140510 20140509 20140508 20140507 20140506 20140505 20140504 20140503 
20140502 20140501


bash-4.3 $ printf "%s " "$(date -d -"{0..9}"days +%Y%m%d)"
date: date non valide « -{0..9}days »


Re: brace expansion fails in 4.3, succeed in 4.2

2014-05-10 Thread NBaH

Le 10/05/2014 22:31, Dan Douglas a écrit :

$ bash -c 'printf -v a "%(%s)T" -1; printf "%(%Y%m%d)T " "$a" 
"${a[a+=60*60*24,0]"{0..8}"}"; echo'
20140510 20140511 20140512 20140513 20140514 20140515 20140516 20140517 
20140518 20140519


Thank you very much.

This is tremendous!

Do you mind explaining a little bit «the way Bash parses array subscripts» ?