Re: declare a="$b" if $a previously set as array

2014-12-08 Thread konsolebox
On Sun, Dec 7, 2014 at 7:24 AM, Stephane Chazelas wrote: > $ b='($(uname>&2))' bash -c 'a=(); declare -r a=$b' > Linux I actually also don't like that form of implementation. Even if declare is a builtin and not a reserved word, it still has some special treatments that's different from a simple

Re: declare a="$b" if $a previously set as array

2014-12-08 Thread Linda Walsh
Eduardo A. Bustamante López wrote: On Mon, Dec 08, 2014 at 12:48:05PM -0800, Linda Walsh wrote: --- This usage ***depends*** on delayed evaluation -- which you claim is "code injection". This is the way shell is supposed to operate. The programmer ***HAS*** to choose when to cause the expre

Re: declare a="$b" if $a previously set as array

2014-12-08 Thread Eduardo A . Bustamante López
On Mon, Dec 08, 2014 at 12:48:05PM -0800, Linda Walsh wrote: > --- This usage ***depends*** on delayed evaluation -- which you > claim is "code injection". This is the way shell is supposed to > operate. The programmer ***HAS*** to choose when to cause the expression > to be evaluated depending

Re: declare a="$b" if $a previously set as array

2014-12-08 Thread Stephane Chazelas
2014-12-08 12:48:05 -0800, Linda Walsh: [...] > declare -x fmt='($(echo uid:$UID) $(echo euid:$EUID) $(date) $(uname -n))' > declare -a out > declare -l out=$fmt > echo "out=${out[@]}" > sudo bash --norc -c 'declare -a out;declare -l out=$fmt; echo > "out=${out[@]}"' > > > > Run that and you

Re: declare a="$b" if $a previously set as array

2014-12-08 Thread Linda Walsh
Stephane Chazelas wrote: 2014-12-07 19:34:53 -0800, Linda Walsh: [...] Stephane Chazelas wrote: declare -l a="$external_input" he's entitled to expect $a to contain the lower case version of $external_input whatever $external_input contain. --- Only if you properly quote "external input".

Re: declare a="$b" if $a previously set as array

2014-12-08 Thread Stephane Chazelas
2014-12-07 19:34:53 -0800, Linda Walsh: [...] > Stephane Chazelas wrote: > > declare -l a="$external_input" > > > >he's entitled to expect $a to contain the lower case version of > >$external_input whatever $external_input contain. > --- > Only if you properly quote "external input". > > If you