转义单引号 Ansible 2.1
Escape Single Quotes Ansible 2.1
使用 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.0.1:54321",
bash 问题多于 ansible:
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 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.0.1:54321",
bash 问题多于 ansible:
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",'\'
在 '\''
中,首先 '
关闭字符串,然后 \'
粘附转义单引号,然后 '
开始粘附下一个字符串。