[Toybox] Would someone please explain what bash is doing here?

Chet Ramey chet.ramey at case.edu
Sat Apr 25 13:19:16 PDT 2020


On 4/24/20 3:07 PM, Rob Landley wrote:

>> I tested on Mac OS using bash-5.0 and bash-4.4. I'm not really interested
>> in testing versions before that.
> 
>   $ bash --version
>   GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
> 
> Devuan ascii 2.0 which is basically debian.
> 
> *shrug* If it doesn't reproduce for you, it doesn't reproduce. Seems impolite
> _not_ to mention these things when I hit 'em since you've been so helpful.

I looked on RHEL7 with bash-5.0.17, since it didn't reproduce with the
devel version, and I did find a problem that seemingly manifested itself
only on Linux (<expressive shrug>). It was worth fixing anyway.

>   $ chicken() { echo ${*/b c/ghi}; }; chicken a b c d
>   a b c d

"If parameter is @  or  *,
the substitution operation is applied to each positional parame-
ter in turn, and the expansion is the resultant list."


> (Still
> dunno what the associative arrays mean 

key-value hash tables; the keys are arbirary strings. You have to watch
evaluation order; that gets tricky when you are parsing a subscript and
looking for the closing bracket.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet at case.edu    http://tiswww.cwru.edu/~chet/



More information about the Toybox mailing list