I'm in trouble doing a sed command inside an ssh call. I need to use single quotes in my sed command. Here is my command line :
ssh root@192.168.0.32 "sed -i '/0 => '192.168.0.32' /a 1 => '$old',' /tmp/test"
Here is the file :
<?php
$CONFIG = array (
'trusted_domains' =>
array (
0 => '192.168.0.32',
),
'dbtype' => 'mysql',
'dbport' => '',
'dbtableprefix' => 'oc_',
'logtimezone' => 'UTC',
'installed' => true,
'redis' =>
array (
'host' => '192.168.0.13',
'port' => 9095,
),
'mail_smtpmode' => 'sendmail',
'mail_from_address' => 'noreply',
'knowledgebaseenabled' => false,
0 => 18,
'loglevel' => 1,
'maintenance' => false,
);
In this context, I want to add in the trusted_domains
for example 1 => '192.168.0.1',
after the first element.
The problem of the command is that he doesn't recognize the single quotes inside the sed command.
Don't forget, the sed command is inside a ssh command