进度条
C语言下的进度条参考我原来的一篇blog->进度条
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function proc() { i=0 str= '' arr=( '|' '/' '-' '\\' ) index=0 while [ $i - le 100 ] do printf "[%-101s][%d%%][%c]\r" "$str" "$i" "${arr[$index]}" str=${str} '#' sleep 0.1 let i++ let index++ let index%=4 done printf "\n" } function main() { proc } main |
最大值,最小值,平均值
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/bin/bash max=0 min=0 count=0 sum =0 while read line do if [ $count - eq 0 ]; then max=$line min=$line let count++ let sum +=$line continue fi [ "$max" -lt "$line" ] && max=$line [ "$min" -gt "$line" ] && min=$line let sum +=$line let count++ done < file echo $max echo $min echo "ibase=10; scale=2; $sum/$count" | bc |
本文转自 七十七快 51CTO博客,原文链接:http://blog.51cto.com/10324228/1840116