I have a sed command that gets most of what I want done with the exception of the '$1' && I haven't figured out how to make it enter the line like I want.
Here is my command:
sed -i 's/# UserParameter=/UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet $1 && echo 1 || echo 0/g' /etc/zabbix/zabbix_agent2.conf
Here is the entry that results:
UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet \ # UserParameter=# UserParameter= echo 1 || echo 0
What I need is:
UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet $1 && echo 1 || echo 0
I am running this from the cli. I know why it is doing this but I haven't figured out how to make it work the way I need it to. Can someone show me how to I believe the phrase is to escape the '$1' and the &&
Thanks alot
Here is my command:
sed -i 's/# UserParameter=/UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet $1 && echo 1 || echo 0/g' /etc/zabbix/zabbix_agent2.conf
Here is the entry that results:
UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet \ # UserParameter=# UserParameter= echo 1 || echo 0
What I need is:
UserParameter=systemd.unit.is-active[*],systemctl is-active --quiet $1 && echo 1 || echo 0
I am running this from the cli. I know why it is doing this but I haven't figured out how to make it work the way I need it to. Can someone show me how to I believe the phrase is to escape the '$1' and the &&
Thanks alot