escaping - How to construct variable name in Bash? -


i want construct variable name n_foo , n_bar , use values in following:

#!/bin/bash n_foo=2 n_bar=3 in { "foo" "bar" }     j in { 1..$(`n_$i`) }             echo $j     done done 

i want use values of n_foo , n_bar in 2 inner loops , print out 1, 2 , 1, 2, 3, respectively. what's correct syntax?

#!/bin/bash n_foo=2 n_bar=3 in "foo" "bar"     key="n_${i}"     eval count='$'$key     j in `seq 1 $count`             echo $j     done done 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -