#!/bin/bash -x
#########!/bin/bash -x
###http://10798301.blog.51cto.com/
####http://blog.csdn.net/zw_1510
#########https://github.com/lenomirei/project
<<"com"
############ .(){ .|. & } ; .################
.|. 函数名 . | 管道 递归调用函数并创建管道 & 置为后台进程
;起换作用 . 调用这个定义的函数
com
for((n=0;n<=10;n++))
do
set -x
echo "$n"
set +x
echo " "
done
read ee
echo "############ my read and addsum start ####################"
for((n=0;n<=100;n++))
do
echo "$n" >>0.txt
done
#cat 0.txt
echo "################################"
sum=0
max=0
min=0
while read LINE
do
#echo $LINE
#echo "$sum+$LINE"| bc
if [ $max -lt $LINE ];then
max=$LINE
fi
[ $min -gt $LINE ]&&{
min=$LINE
}
let sum+=$LINE
done < 0.txt
echo "sum===="$sum
echo "max===="$max
echo "min===="$min
rm 0.txt
# for i in `cat 0.txt`
# do
# echo $i
# done
#read ee
#for((n=0;n<=100;n++))
#do
# tmp=`cat 0.txt`
# echo "$tmp $n " >>0.txt
#done
#cat 0.txt
#echo $line
echo "############ my read and addsum end ####################"
exit
read ee
echo "scale=4;1/3" | bc
echo "obase=2;scale=4;1/3" | bc
echo "sqrt(100)" | bc
read ee
read x
case $x in
1[1-9] ) echo "1:$x"
;;
2? ) echo "2:$x"
;;
* ) echo "default:$x"
;;
esac
read ee
i=0
until [ $i -gt 10 ]
do
let i++
echo $i
done
read ee
i=0
while [ $i -lt 10 ]
do
let i++
echo $i
done
#for i in {a..z}
for ((i=0;i<10;i++))
do
echo "$i"
done
echo "############ myfun start ####################"
function myfun()
{
shift 1
echo "\$0->"$0
echo "\$1->"$1
echo "\$2->"$2
echo "\$#->"$#
echo "\$$->"$$
return 257
}
myfun argv1 argv2 argv3
echo $? ##1 256+1
echo "############ myfun end ####################"
echo "######### proc start #######################"
i=0
str=""
arr=("|" "/" "--" "\\")
while [ $i -le 70 ]
do
let index=i%4
printf "[%-100s][%d%%][%c]\r" "$str" "$i" "${arr[$index]}"
sleep 0.1
let i++
str+=‘#‘
done
echo "######### proc end #######################"原文:http://wzsts.blog.51cto.com/10251779/1839679