for迴圈的使用1
for ((i=0;i<=5;i++));
do date=`date +%y%m%d -d "$i days ago"`
showdate=$showdate" "$date
echo $showdate
done
輸出
20120319
20120319 20120318
20120319 20120318 20120317
20120319 20120318 20120317 20120316
20120319 20120318 20120317 20120316 20120315
20120319 20120318 20120317 20120316 20120315 20120314
for迴圈的使用2
for ((i=3;i<=49;i++))
do date=`date +%y%m%d -d "$i days ago"`
datemd=`date +%y%m -d "$date"|awk ''`
datef=`date +%y-%m-%d -d "$date"`
filelist=$filelist" "`ls /gfs-ro-data-ad/ie/data/$datemd/$datef/cd_ie_log*`
echo $filelist
done
shell script 中 set的用法
使用set命令可以 設定各種shell選項或者列出shell 變數.單個選項設定常用的特性.在某些選項之後 o引數將特殊特性開啟.在某些選項之後使用 o引數將關閉某些特性,不帶任何引數的set命令將顯示shell的全部變數.除非遇到非法的選項,否則set總是 返回ture.當bash shell被呼...
shell script中的迴圈語法
1 while do done,util do done 不定迴圈 while 的中文是 當 時 所以,這種方式說的是 當 condition 條件成立時,就 進行迴圈,直 到condition 的條件 不成立才停止 的意思。這種方式恰恰不與while 相反,它說的是 當 condition 條件成...
shell script中read的用法
1 read基本讀取 bin bash testing the read command echo n enter you name echo n 讓使用者直接在後面輸入 read name 輸入的多個文字將儲存在乙個變數中 echo hello name,welcome to my progra ...