How to use a bash script variable with sed [duplicate]

sed "s/\${version.number}/$version/" template.txt > readme.txt

Only double quotes do dollar-sign replacement. That also means single quotes don't require the dollar sign to be escaped.


You could also simply unquote the variables

sed 's/'${version.number}'/'$version'/' template.txt > readme.txt