Hi
I am writing a bash script in which i need to set variables in a for loop.
This doesn't seem to work and I'm not sure why it is any different to setting them any where else in the script.
I have tried:
but i just get a series of:
-bash: V1=test: command not found
V1="test" would work fine so why cant i do it in a for loop?
Thank you
I am writing a bash script in which i need to set variables in a for loop.
This doesn't seem to work and I'm not sure why it is any different to setting them any where else in the script.
I have tried:
Code:
array=(1 2 3 4 5 6 7 8 9); for i in ${array[*]}; do "V$i"="test"; done
but i just get a series of:
-bash: V1=test: command not found
V1="test" would work fine so why cant i do it in a for loop?
Thank you