當我作了 rm -f /root/cross/* 時,它出現
-bash: /bin/rm: 引數列項目過長 (Argument list too long)
原來shell是有限制長度 !?
這個可以知道是多長,執行
getconf ARG_MAX
它給我數值是 2621440
我測試建了 2621440 個文字檔
for (( x=1 ; x<2621440 ; x++ )) ; do touch /root/cross/$x; done
但是只到約 1000000 就仍是出現 Argument list too long
ls /root/cross/|wc 1046067 1046067 7257432 行數 單字數 字元數
是我誤解了嗎,原來ARG_MAX不是指實際檔案數量,好像也不是字元數
找不到到底是什麼 ~”~,算了
還是有其它方式可以刪
cd /root/cross/ ; ls | xargs -0 rm -f find /root/cross -type f -print0 | xargs -0 rm find /root/cross -type f -delete find /root/cross -type f | xargs rm find /root/cross -type f -exec rm {} \;
留言