2.if条件语句
if [ -x /sbin/quotaon ]; then
echo "Turning on Quota for root filesystem"
/sbin/quotaon /
elif [ -x /sbin/quotaon ]; then
/usr/bin/bash
else
echo "ok"
fi
3.for 循环
#!/bin/sh
WORD="a b c d e f g h i j l m n o p q r s t u v w x y z"
for i in $WORD ; do
echo $i
done
#!/bin/sh
FILES=`ls /txt/*.txt`
for txt in $FILES ; do
doc=`echo $txt | sed "s/.txt/.doc/"`
mv $txt $doc
done
4.while和until 循环
#!/bin/sh
while [ -f /var/run/ppp0.pid ] ; do
killall pppd
done
#!/bin/sh
until [ -f /var/run/ppp0.pid ] ; do
sleep 1
done