I have a shell file which needs to perform a replace of some text in a php file.
The line that needs replacing is:
$database = $db."_db";
The actual sed command needs to contain a variable so not sure what i should be escaping and where?
#!/bin/sh
sed -i s/$db."db"/$DATABASE/ mysql_connect.php
Thanks.
Enclose the string in single quotes to prevent variable expansion.
to replace all occurrences of
$db."_db"
with the value of$DATABASE
.