分类: LINUX
2009-05-24 02:56:40
if语句:
if [ "22" -lt "33" ]
then
echo "22 less than 33"
else
echo "no"
fi
case语句:
echo "enter a number"
read ans
case $ans in
1)
echo "you numer is $ans"
;;
2)
echo "you number is 2"
;;
[3-9])
echo "you number is $ans"
;;
*)
echo "You are input not a sinle number!"
esac
while语句:
i=1
while [ $i -lt 10 ]
do
echo $i >> newfile
let i=i+2
done
for语句:
for server in `cat /etc/hosts`
do
echo $server
done
for((i=0; i<10; i++))
do
echo $i
done