码迷,mamicode.com
首页 > 其他好文 > 详细

shell 练习

时间:2014-06-17 14:23:45      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   http   color   

 

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

 

 

 

 

 

 

 

 

 

shell 练习,布布扣,bubuko.com

shell 练习

标签:style   class   blog   code   http   color   

原文地址:http://www.cnblogs.com/mjorcen/p/3791539.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!