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 policy”. 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"
Can you give me an idea how to do it, please?
removes the shortest match of
*=from the left. Note that this is not in place: if you want to save the result, you’ll have to store the result in a variable.On a side note, this is for bash. AFAIK it also works for ksh and zsh, but not csh or tcsh.