I'm trying to use
sed to replace some PHP lines.
My problem is I want to replace a line with PHP variables with a string including a Bash variable.
Here is an example:
sudo sed -i 's/$sUrl . $this_sOutDir/https:\/\/'$bucketname'.s3.amazonaws.com . $this->_sOutDir/g' /var/www/html/$name/core/oxconfig.php
As you can see, I want to replace
$sUrl . $this->_sOutDir (literally) with the s3 URL, which includes a Bash variable. I'm trying to use double quotes but it's not working for me:
sudo sed -i 's/$sUrl . $this_sOutDir/https:\/\/"$bucketname".s3.amazonaws.com . $this->_sOutDir/g' /var/www/html/$name/core/oxconfig.php
I'm also trying to use the complete
s/... in double quotes but it's not working because
sed thinks that the first variables are also Bash variables.
The result is:
return https://.s3.amazonaws.com . $this->_sOutDir . '/';