Re: Changing the way bash expands associative array subscripts

2021-03-30 Thread konsolebox
On Tue, Mar 16, 2021 at 8:12 AM Chet Ramey wrote: > This means that, given the following script, > > declare -A a > key='$(echo foo)' > a[$key]=1 > a['$key']=2 > a["foo"]=3 > > # never worked > unset -v a[$key] > declare -p a > > # unsets element with key $key > unset -v a['$key'] > declare -p a

Re: zsh style associative array assignment bug

2021-03-30 Thread Ilkka Virta
On Tue, Mar 30, 2021 at 1:40 AM Eric Cook wrote: > Its just when populating that array dynamically with another array > if that second array didn't contain `v1' hypothetically, the array gets > shifted to > > a=( [k1]=k2 [v2]=k3 [v3]= ) > which i would imagine to be unexpected for the author of

Re: incorrect character handling

2021-03-30 Thread Lawrence Velázquez
On Tue, Mar 30, 2021, at 4:50 PM, Greg Wooledge wrote: > On Wed, Mar 31, 2021 at 02:31:46AM +0700, by.sm--- via Bug reports for > the GNU Bourne Again SHell wrote: > > poc=whoami > > $poc > > python3 -c "print('!!')" > > > > That return 'whoami' command. > > You're running into the csh-style

Re: incorrect character handling

2021-03-30 Thread Greg Wooledge
On Wed, Mar 31, 2021 at 02:31:46AM +0700, by.sm--- via Bug reports for the GNU Bourne Again SHell wrote: > poc=whoami > $poc > python3 -c "print('!!')" > > That return 'whoami' command. You're running into the csh-style history expansion. A lot of us simply disable it, because it's not worth

Re: incorrect character handling

2021-03-30 Thread Eduardo Bustamante
On Tue, Mar 30, 2021 at 1:38 PM by.sm--- via Bug reports for the GNU Bourne Again SHell wrote: > > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: darwin18.7.0 > Compiler: clang > Compilation CFLAGS: -DSSH_SOURCE_BASHRC > uname output: Darwin Mac 18.6.0

incorrect character handling

2021-03-30 Thread by . sm--- via Bug reports for the GNU Bourne Again SHell
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: darwin18.7.0 Compiler: clang Compilation CFLAGS: -DSSH_SOURCE_BASHRC uname output: Darwin Mac 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

Re: zsh style associative array assignment bug

2021-03-30 Thread Chet Ramey
On 3/30/21 12:42 PM, Eric Cook wrote: On 3/30/21 10:54 AM, Chet Ramey wrote: On 3/29/21 6:40 PM, Eric Cook wrote: Its just when populating that array dynamically with another array if that second array didn't contain `v1' hypothetically, the array gets shifted to OK, how would you do

Re: Defaults -- any

2021-03-30 Thread Greg Wooledge
On Tue, Mar 30, 2021 at 09:54:35AM -0700, L A Walsh wrote: > On 2021/03/29 20:04, Greg Wooledge wrote: > > On Mon, Mar 29, 2021 at 07:25:53PM -0700, L A Walsh wrote: > > > > > >I have both /etc/profile and /etc/bashrc call my configuration > > > scripts. Are there common paths that don't

Re: zsh style associative array assignment bug

2021-03-30 Thread Greg Wooledge
On Tue, Mar 30, 2021 at 12:42:46PM -0400, Eric Cook wrote: > typeset -A tags=(); set -- > while IFS='|' read -ra ary; do > set -- "$@" "${ary[@]}" > done < <( > exiftool -j *.flac | > jq -r '.[]| {Artist, Track, Genre, Title}|to_entries[]| .key + "|" + .value' > ) > eval 'tags=('"${*@Q}"\) >

Re: Defaults -- any

2021-03-30 Thread Lawrence Velázquez
On Tue, Mar 30, 2021, at 12:54 PM, L A Walsh wrote: > On 2021/03/29 20:04, Greg Wooledge wrote: > > On Mon, Mar 29, 2021 at 07:25:53PM -0700, L A Walsh wrote: > > > >> > >>I have both /etc/profile and /etc/bashrc call my configuration > >> scripts. Are there common paths that don't call

Re: Defaults -- any

2021-03-30 Thread L A Walsh
On 2021/03/29 20:04, Greg Wooledge wrote: On Mon, Mar 29, 2021 at 07:25:53PM -0700, L A Walsh wrote: I have both /etc/profile and /etc/bashrc call my configuration scripts. Are there common paths that don't call one of those? A vanilla bash compiled from GNU sources with no

Re: zsh style associative array assignment bug

2021-03-30 Thread Eric Cook
On 3/30/21 10:54 AM, Chet Ramey wrote: > On 3/29/21 6:40 PM, Eric Cook wrote: >> Its just when populating that array dynamically with another array >> if that second array didn't contain `v1' hypothetically, the array gets >> shifted to > > OK, how would you do that? What construct would you use

Re: zsh style associative array assignment bug

2021-03-30 Thread Chet Ramey
On 3/29/21 6:40 PM, Eric Cook wrote: On 3/29/21 5:18 PM, Chet Ramey wrote: If you look at a=( k1 v1 k2 v2 k3 v3) as more or less syntactic sugar for a=( [k1]=v1 [k2]=v2 [k3]=v3 ) it's reasonable that a=( k1 v1 k2 ) is equivalent to a=( [k1]=v1 [k2]= ). And that's what bash does. Its

Re: Changing the way bash expands associative array subscripts

2021-03-30 Thread Chet Ramey
On 3/29/21 8:07 PM, Marco Ippolito wrote: Examples are more for the texinfo documentation; the man page is big enough already. What goes in the man page Vs in the texinfo documentation, please? It's a rough convention. The man page is more for a technical description of bash and its