0
subprocess.call(["find", ".", "-exec", "sh", "-c", "echo testFirst", ";"])
subprocess.call(["find", ".", "-exec", "sh", "-c", "echo testSecond", ";"], shell=True)
subprocess.call(["find . -exec sh -c 'echo testThird' \\;"], shell=True)
subprocess.call(["find", ".", "-exec", "sh", "-c", "touch testFirst", ";"])
subprocess.call(["find", ".", "-exec", "sh", "-c", "touch testSecond", ";"], shell=True)
subprocess.call(["find . -exec sh -c 'touch testThird' \\;"], shell=True)
產出如下:奇怪子行爲
testFirst
testFirst
testFirst
.
./test.py
./data
testThird
testThird
testThird
.
./test.py
./testFirst
./data
而且只有testFirst
和testThird
文件被創建。
行爲的解釋是什麼?
我會假設輸出爲testFirst
,testSecond
,testThird
以及正在創建的三個文件。
爲什麼你需要前4個參數呢? –
這不是我的實際代碼,我只是縮小範圍來證明問題。 –