I need to read a value of variable and set it to zero and again set back to old value I tried these steps
value=$(grep -Po '(?<=Max_value=).*' /usr/post_check.ini|awk '{print $1}')
sed -i -r 's/Max_value=[0-9]+/Max_value=0/g' /usr/master.ini
echo "$value" # say $value is 3
sed -i -r 's/Max_value=[0-9]+/Max_value=$value/g' /usr/master.ini
value=$(grep -Po '(?<=Max_value=).*' /usr/master.ini|awk '{print $1}')
echo "$value"
The above code is setting the value Max_value to $value[I mean actual to text $value but not value contained it which is 3 like "Max_value=$value" and not to Max_value=3] but not to old value
If I reset it to zero and try to set it back to old value How would I do that ?