Reputation: 1700
I have the following file:
mongo
'mongodb' => [
'driver' => 'mongodb',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 27017),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'options' => [
'database' => 'admin' // sets the authentication database required by mongo 3
]
],
and the sed command:
sed -i "/'connections' => \[/a \ "$(cat mongo)" \\" /app/config/database.php
So I want to insert the content of mongo
file after the string:
'connections' => [
The search is good, sed founds the string, but does not get properly the content of the file mongo
.
I get the following errors:
sed: can't read 'mongodb': No such file or directory
sed: can't read =>: No such file or directory
sed: can't read [: No such file or directory
sed: can't read 'driver': No such file or directory
sed: can't read =>: No such file or directory
sed: can't read 'mongodb',: No such file or directory
sed: can't read 'host': No such file or directory
Upvotes: 0
Views: 123
Reputation: 58578
This might work for you (GNU sed):
sed -i '/'\''connections'\'' => \[/r mongoFile' file
Read the mongoFile in after the connections
address.
Upvotes: 1