0

I make some script Like this

#!/bin/bash
function AA() {
    i=$1
    for j in {0..100}; do
       declare AA_$j_$i="$j $i" &     # -> like multi thread process
    done
    wait
    for k in $(seq 0 $i); do
        Val=$(eval echo "AA_$j_$i")
        echo $Val
    done
}
for i in {0..100}; do
    AA ${i}&    
done
wait

this script didn't work ( can't print line )

it's like 2-dimensional array but bash don't have multi-dimensional array

Please help me ~!

정종현
  • 31
  • 3
  • Are you looking for [Dynamic variable names](https://stackoverflow.com/q/16553089/3266847)? – Benjamin W. Nov 13 '20 at 04:49
  • 1
    Bash doesn't really have 2D arrays, but it can fake it pretty well. [How to declare 2D array in bash](https://stackoverflow.com/questions/16487258/how-to-declare-2d-array-in-bash) – jeremysprofile Nov 13 '20 at 04:54

0 Answers0