如果我运行这个命令
/bin/bash -c 'while true;do /usr/bin/etcdctl set my-container "{\"host\": \"1\", \"port\": $(/usr/bin/docker port my-container 5000 | cut -d":" -f2)}" --ttl 60;sleep 45;done'
我从 etcd 得到我期望的结果 {"host":"1", "port":49155}
但是如果我把它放在一个 systemd 文件中
ExecStart=/bin/bash -c 'while true;do /usr/bin/etcdctl set my-container "{\"host\": \"1\", \"port\": $(/usr/bin/docker port my-container 5000 | cut -d":" -f2)}" --ttl 60;sleep 45;done'
我回来了 {host:1, port:49155}
知道为什么文件内部的转义不同吗?我该如何解决?谢谢!!