@WHILE Loop Statement @
V1=1
While ["$v 1"-lt "6"] #注 [and] have spaces around them,-lt have spaces before and after them.
Todo
echo "This is the $v 1 ' showing up"
v1=$ (($v 1+1)) #注意 $ (()) is a mathematical formula
Done
@FOR Loop Statement @
For ((i=1;i<= $LENGTH _extend_days;i++))
Todo
...
Done
For example
Filelist= ""
For ((i=1;i<= $LENGTH _extend_days;i++))
Todo
datei= ' Date +%y%m%d-d $DATE $i days ago '
If [$i-le $LENGTH _days]; Then
file= $OUTPUT _path/$DATEi/1day.txt
Else
file= $OUTPUT _path/$DATEi/1day_one.txt
Fi
If [-s $file]; Then
tempfile= $file. tmpfile
Cat $file |awk-f "\ T"-V delta= $i ' {printf ('%s ', ' $ '; for (i=2; i<=nf;i++) {Split ($i, A, ' | '); printf ("\t%s|%s|%s|%d", a[1],a[2],delta+1,a[3]); printf ("\ n")} ' > $tempfile
filelist= $filelist "" $tempfile
Fi
Done
Sort-m--temporary-directory=./$filelist > $WEEK _merge.imcomplete
MV $WEEK _merge.imcomplete $WEEK _merge
Rm-f $filelist
@ Traverse file in folder @
Index_file_list= ' Ls$index_website_dir '
For Index_file_name in $INDEX _file_list
Todo
index_time=${index_file_name#*.}
cache_file_hourly_output= $CACHE _dir/cache.file. $INDEX _time
Awk-f "\ T" ' {
Cache_map_single_file[$1]=$3
}end{
For (i in Cache_map_single_file)
Printi "T" FILENAME "-" cache_map_single_file[i]
} ' > $CACHE _file_hourly_output $INDEX _website_dir/$INDEX _file_name
Done
@ Traverse file in folder @
filelist= ' ls A '
for filename in $filelist
Todo
Your-command $filename >${filename}.new
Done