我已經編寫了一個腳本來獲取我的S3存儲的大小,該腳本可以很好地阻止它繼續循環並永不結束的事實。我可以根據需要獲得所有輸出,但它一直在通過它們。S3 Bash腳本循環
任何想法爲什麼它的循環?
#!/bin/sh
DAY=$(date +"%d%b%Y")
BUCKET='/home/user/Scripts/Holding/s3buckets.txt'
BLIST='/home/user/Scripts/Holding/blist.txt'
LOGDIR='/home/user/Scripts/Holding/'
USAGE=$BLIST
s3cmd ls > $BUCKET
awk '{print $3}' $BUCKET > $BLIST
while read USAGE; do
s3cmd du -H $USAGE
done < $BUCKET > $LOGDIR/S3Usage$DAY.txt
's3cmd ls'輸出的格式是什麼? – jman
'2011-01-28 15:24 s3:// bucket1 2010-12-24 10:51 s3:// bucket2' – Grimlockz
爲什麼當你打算用'USAGE = $ BLIST'來打開它時'一邊讀... <$ BUCKET'? – blahdiblah