I am writing a shell script for some purpose. I have a variable of the form -- var1 = "policy=set policy"
Now I need to manipulate the variable var to get the string after index =. that is i should have "set polcy". Also I need to to this for many other variables where the value of "=" is not constant. Like
var2 = "bgroup = set bgroup port"
var3 = "utm = set security utm"
Please give an idea how to do it.
#!/bin/bash
##!/bin/bash
var2="bgroup = set bgroup port"
var3="utm = set security utm"
echo "$var2 --> '${var2# = }'"
echo "$var3 --> '${var3# = }'"
# You can also
for V in var2 var3; do
echo "${!V} --> '${!V# = }'"
done#