I am trying to create a dynamic variable and assign 100
to it
#!/bin/bash
.
.
active_id=$p_val
flag_$active_id=100
But I am getting error in doing so, any help ?
I am trying to create a dynamic variable and assign 100
to it
#!/bin/bash
.
.
active_id=$p_val
flag_$active_id=100
But I am getting error in doing so, any help ?
You can use bash's declare directive and indirection feature like this:
TESTING:
UPDATE:
Usage in
if condition
:I don't know what this should be good for but you can achieve stuff like this with bash's
eval
statement.The following code illustrates that.
The terminating
echo
's putson the
stdout
.