I have two variables -
regex="<version>[0-9]*\.[0-9]*\.[0-9]*[^<]*<\/version>"
updated_regex="<version>${main_version}\.${feature_version}\.${patch_version}${tag}<\/version>"
Which i want to use in following command -
sed "s/$regex/$updated_regex/1" pom.xml
But it is not working as the regex and variables are not being evaluated or substituted in my command.
updated_regex
are expanded as soon as you run the line assigning theupdated_regex
variable, NOT when you run thesed
line.