I'm trying to parse key=value pair using awk in a bash script
A sample key/value is like:
time=2
where I can retrieve the value using something like this:
echo time="2" | awk -F= '$1=="time"{print $2}'
Now I want to put this in a bash script, and use a function to specify the key to retrieve the value, basically have an argument, something like this (which does not work) :
get_value() {
    variable=$1
    echo time="2" | awk -F= '$1=="${variable}"{print $2}'
}
get_value "time"
How should I handle this case?
 
    