five.day_shellcase语句

case结构条件句的语法格式为:
case "变量" in
值1)
指令1...
;;
值2)
指令2...
;;
*)
指令3...
esac

16833129-f82ee7f532e44cda.png
image.png
16833129-750bf45a801a5f89.png
image.png
16833129-6cfeda639b44e94a.png
image.png

[root@web01 /server/scripts]# kill %1
[root@web01 /server/scripts]# jobs
[1]- 已终止 shwhile1.sh
[2]+ 运行中 shwhile1.sh &
[root@web01 /server/scripts]# jobs
[2]+ 运行中 shwhile1.sh &
[root@web01 /server/scripts]# kill %2
[root@web01 /server/scripts]# jobs
[2]+ 已终止 sh while1.sh

/var/lock/subsys作用


[root@web01 /server/scripts]# cat while2.sh
#!/bin/bash
 
sum=0
while read line
do
    i=`echo $line|awk '{print $NF}'`
    let sum=sum+i
done<./stu.txt
echo $sum

猜你喜欢

转载自blog.csdn.net/weixin_34234721/article/details/90779197
今日推荐