use*_*884 3 python linux awk command escaping
我在远程服务器上发出以下命令时遇到问题.| awk'{print $ 1}'似乎对输出没有任何影响.我错误地转义了引号字符吗?更糟糕的是,这两个命令实际上是通过python脚本提交的...因此让逃避变得更加混乱......
在本地服务器上:
ssh remote.server.com "find /root/directory -type f -exec md5sum {} + | awk '{print $1}'"
Run Code Online (Sandbox Code Playgroud)
在远程服务器上:
find /root/directory -type f -exec md5sum {} + | awk '{print $1}'
Run Code Online (Sandbox Code Playgroud)
我们问shellcheck:
In yourscript line 1:
ssh remote.server.com "[...] | awk '{print $1}'"
^-- SC2029: Note that, unescaped, this
expands on the client side
Run Code Online (Sandbox Code Playgroud)
你去吧 你可以用反斜杠来逃避它.