I have a config file which looks like this:
$this->db_host = 'localhost';
$this->db_port = '3306';
$this->db_name = 'database';
$this->db_user = 'root';
Im trying to replace the values between the single quotes with sed env-variables I have set but I cant seem to get it working. My sed command looks like this right now.
sed -r -in "s/(db_host *= *\").*/\1$MYSQL_HOST\"/" cfg.php
The $MYSQL_HOST-var contains the following string "db".
The config should look like the following after the successful sed command:
$this->db_host = 'db';
$this->db_port = '3306';
$this->db_name = 'database';
$this->db_user = 'root';
Maybe you can help me find my error?