I bring few suggestions for improvement into your consideration.

I thought about printf -v T[0] %s...
then I thought about what could T[@] possibly mean in this context?

Here is my suggestion (".|" means commandline and "-|" means its output):

.|echo  {a..c}{0..2}
-|a0 a1 a2 b0 b1 b2 c0 c1 c2
.|declare -a T=();
.|printf -v 'T[@]' '%s %s %s' {a..c}{0..2};
.|printf '%s\n' "${T[@]}";
-|a0 a1 a2
-|b0 b1 b2
-|c0 c1 c2
.|printf -v 'T[@]:1' '%s %s %s' {d..f}{0..2};
.|printf '%s\n' "${T[@]}";
-|a0 a1 a2
-|d0 d1 d2
-|e0 e1 e2
-|f0 f1 f2
.|printf -v 'T[@]:2:1'  '%s %s %s' {g..i}{0..2};
.|printf '%s\n' "${T[@]}";
-|a0 a1 a2
-|d0 d1 d2
-|g0 g1 g2
-|f0 f1 f2
.|printf -v 'T[@]:-1:2' '%s %s %s' {a..c}{0..2};
.|printf '%s\n' "${T[@]}";
-|a0 a1 a2
-|d0 d1 d2
-|g0 g1 g2
-|a0 a1 a2
-|b0 b1 b2

Similar effect in part can be had with this code:

declare -i L=;
while read A B C;
do T[L++]="$A $B $C";
        done < <(
printf '%s %s %s\n' {a..c}{0..2});

Thank you for your attention.

  • Improvement fo... Toni Kauppi
    • Re: Impro... Félix Hauri via Bug reports for the GNU Bourne Again SHell
      • Re: I... Félix Hauri via Bug reports for the GNU Bourne Again SHell

Reply via email to