I am trying a small code which is
for(( i =0;i<2;i++ )); do p$i=\"pra$i\"; done
expected output is: Variable must be assigned
p0="pra0"
p1="pra1"
But bash is taking that as command and am getting output as
p0="pra0": command not found
p1="pra1": command not found
Thanks
Use
eval
to have the value evaluated and stored as you want:Or better with
declare
(thanks chepner as always!):