I´m wondering how can i just replace this variable easily in BASH:
VARIABLE1="VALUE2=somestring2 VALUE3=TRUE"
I need just to change VALUE2=somestring2 (which is just part of the string) with a new value that replaces it:
i am just using this:
VARIABLE1="${VARIABLE1//VALUE2=[a-z0-9-]*/}VALUE2=${VALUE2}"
where VALUE2=${VALUE2} is a new value that i specify in some line.
but there are two problems here:
1- the line where i overwrite the VALUE2=somestring2 deletes VALUE3=TRUE from VARIABLE1
2- looks like after overwrite VALUE2, it puts a "space" at the beginning of "VALUE2=somestring2"
echo $VARIABLE1 " VALUE2=somestring2"
Any way to fix this?