linux - Bash declaring variable with a number inside a for loop -


this question has answer here:

i can't find answer problem, other people asking use array instead. that's not want. want declare number of variables inside loop same name except index number.

i=0 int in $ints; i=[$i +1]; intf$i=$int; done 

it doesn't work. when run script thinks middle part intf$i=$int command.

without array, need use declare command:

i=0 int in $ints;     i=$((i +1))     declare "intf$i=$int" done 

with array:

intf=() int in $ints;     intf+=( $int ) done 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -