shell 练习
shell 练习
iii=0 while [ $iii -lt 100 ] do iii=$[$iii+1] echo -n "$iii " done iii=0 until ! [ $iii -lt 100 ] do iii=$[$iii+1] echo -n "$iii " done echo while until num is done while true do echo 'plase input your operate !' read BBB if [ "$BBB" = "out" ] then break fi done echo while until is done for i in root mjorce jorcen normal do echo i is $i done echo i si $i ; for f in 123 4123 /etc/profile.d/*.sh do echo f is $f done for i in `seq 1 3` do echo -n "$i " && sleep 1 done PIDS="`pgrep httpd`" [ -z "$PIDS" ] && echo 'httpd is not running !' && echo exi for i in $PIDS do kill -9 $i done echo httpd is killed Myfun (){ echo patams1 is $1 echo -n "now i is $i " ! [ "$i" ] && exit ; echo jj return '1' } myf=$(Myfun); echo myf Myfun 12 unset Myfun Myfun echo 'the end !'$myf