Shell variables in sed script
Use double quotes for the sed
expression.
new_db_name=$(echo "$new_db_name" | sed "s/$replace_string/$replace_with/")
This worked for me in using env arguments.
export a=foo
export b=bar
echo a/b | sed 's/a/'$b'/'
bar/b
If you use bash, this should work:
new_db_name=${new_db_name/$replace_string/$replace_with}