I am trying script a file that will install VirtualBox Headless. I am lacking one part to accomplish it. phpVirtualBox requires you to edit the config.php file and change the password. The section I am trying to modify is:
/* Username / Password for system user that runs VirtualBox */
var $username = 'vbox';<br>
var $password = 'pass'; **********This Line*****************
I've read (man sed) and looked all over the internet for a solution, no luck.
I have tried multiple sed commands but none will insert the ' tick marks.
I was able to get everything except the ('). These marks need to surround the password to make the config.php file work properly.
I am able to delete the entire line then trying to insert a new line only inserts:
var $password = pass ;
Can anyone please help me figure out how to insert the full line:
var $password 'pass';
I'll post the full script is anyone is interested in using it.
Just keep the '' unchanged and replace the value inside:
echo "var \$password = 'pass';" | sed "s@'pass'@'newpass'@"
Result
var $password = 'newpass';