转义单引号Ansible 2.1
使用Ansible 2.1转义单引号Ansible 2.1,ansible,ansible-2.x,Ansible,Ansible 2.x,使用Ansible 2.1 ansible all -i 127.0.0.1, -m lineinfile -a "dest=/etc/engine/engine.json state=present regexp=\"rpc_json\" line='\"rpc_json\": \"127.0.0.1:54321\"'," 命令起作用,但增加了 '"rpc_json": "127.0.0.1:54321"', 请告诉我如何删除单个报价,以便 "rpc_json": "127.0
ansible all -i 127.0.0.1, -m lineinfile -a "dest=/etc/engine/engine.json state=present regexp=\"rpc_json\" line='\"rpc_json\": \"127.0.0.1:54321\"',"
命令起作用,但增加了
'"rpc_json": "127.0.0.1:54321"',
请告诉我如何删除单个报价,以便
"rpc_json": "127.0.0.1:54321",
与其说是回答问题,不如说是回答问题:
ansible all -i 127.0.0.1, -m lineinfile -a 'dest=/etc/engine/engine.json state=present regexp=rpc_json line='\''"rpc_json": "127.0.0.1:54321",'\'
在
'\'
中,首先'
关闭字符串,然后\'
粘贴转义的单引号,然后'
开始粘贴下一个字符串。这是一个更为棘手的问题,而不是答案:
ansible all -i 127.0.0.1, -m lineinfile -a 'dest=/etc/engine/engine.json state=present regexp=rpc_json line='\''"rpc_json": "127.0.0.1:54321",'\'
在'\'
中,首先'
关闭字符串,然后\'
粘贴转义的单引号,然后'
开始粘贴下一个字符串