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 -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -