Ad Widget

Collapse

SED help editing Agent2.conf

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • edlentz
    Member
    • Oct 2013
    • 31

    #1

    SED help editing Agent2.conf

    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

    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
Working...