0
我試圖讓這個進程有很多文件,但我不想看它,所以我不必監視它。zsh進程文件腳本
#!/usr/local/bin/zsh
X=${1-20}
for ((N=1; N<=X; N++)); do
for p in *.xml; do
curl -X POST -H "Content-Type:application/xml" -d "@${p}" "https://url /postAPI" > "post_${p}"
sleep 1
done
done
當做./work.sh 5這個循環永遠!
什麼導致無限循環?
編輯基於以下
/tmp/tmp.KeFYeM9Z % ls -l
total 4
-rwxr-xr-x 1 naes wheel 218 Nov 20 14:42 work.sh
#!/usr/local/bin/zsh
X=${1-20}
for ((N=1; N<=X; N++)); do
for p in /tmp/tmp.u6RnKaJ3/*.xml; do
curl -X POST -H "Content-Type:application/xml" -d "@${p}" "https://url /postAPI"
sleep 1
done
done
評論這仍然延續了無限循環
這不:
% cat work1.sh
#!/usr/local/bin/zsh
X=${1-20}
for ((N=1; N<=X; N++)); do
date
sleep 1
done
% ./work1.sh 5
Thu Nov 20 15:22:27 PST 2014
Thu Nov 20 15:22:28 PST 2014
Thu Nov 20 15:22:29 PST 2014
Thu Nov 20 15:22:30 PST 2014
Thu Nov 20 15:22:31 PST 2014
在我的循環是什麼原因導致無限?
所以你說只是有輸出保存OUTSIDE目錄劇本嗎?它到什麼子目錄? /tmp/tmp.u6RnKaJ3是我現在的地方。 '%./work.sh 1 ./work.sh:5:權限被拒絕:/tmppost_9713171.xml ./work.sh:5:權限被拒絕:/tmppost_973805.xml ./work.sh:5:權限被拒絕:/tmppost_9819880.xml ./work.sh:5:權限被拒絕:/ tmppost_post_9713171.xml' – 2014-11-20 22:37:28
即使當我創建一個新的tmp目錄時,複製腳本,cd到該目錄,將其修改爲在以前的目錄中運行,它沒有任何中斷地循環。 – 2014-11-20 22:43:43
@RegisteredUser:嘗試我已添加的腳本 – Wolph 2014-11-21 14:23:11