sed -i 's/# ListenIP=0.0.0.0/ListenIP=$[hostname -I]' /etc/some.conf
I need to Change the Listen Ip to its own IP, so what's the correct way of inserting hostname -I
into the SED command?
CodePudding user response:
Use command substitution $()
to call a subshell:
sed -i "s/# ListenIP=0.0.0.0/ListenIP=$(hostname -I)/" /etc/some.conf