我目前有以下内容:
subprocess.Popen(["find", ".", "-exec", "sh", "-c",
"\"echo 'this will not echo'; touch testing.txt \"", ";"], shell=True)
哪个似乎不起作用(没有生成或从echo语句输出testing.txt文件)。
使用subprocess.Popen
上述命令是否可以正常工作?如果是的话,我需要做一些调试......
我基本上是想跑:
find . -exec sh -c "echo 'test'; touch abcxyz" \;
答案 0 :(得分:0)
通过以下方式解决:
subprocess.Popen(["find", ".", "-exec", "sh", "-c", "echo 'this will not echo'; touch testing.txt ", ";"])
已移除shell=True
。