I try to put the result value of this command:
sed "s/\$ip/${ip}/g" xdebug.conf
Provided from this file xdebug.conf
:
zend_extension = xdebug.so
xdebug.remote_enable = 1
xdebug.remote_host = $ip
xdebug.remote_port = 9091
xdebug.max_nesting_level = 1000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
xdebug.remote_log=xdebug.log
Into a variable named $conmfiguration
.
In order to achieve that I try:
ip="125.12.22.1"
$configuration=$(sed "s/\$ip/${ip}/g" xdebug.conf)
But I get the following weird result:
=zend_extension: command not found
DO you know why that happens?
Here,
$configuration=$(sed "s/\$ip/${ip}/g" xdebug.conf)
both $configuration
and $(sed ...)
get expanded. If the variable is empty, you get
=zend_extension = xdebug.so ...
The first word is taken as a command, and the rest as arguments to it. The shell tries to find =zend_extension
, fails, and complains.
Remove the $
from the left-hand side of the assignment, then the assignment works. This outputs foo bar
:
var=$(echo foo bar)
echo $var
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments