case结构条件句的语法格式为:
case "变量" in
值1)
指令1...
;;
值2)
指令2...
;;
*)
指令3...
esac
![](https://img.haomeiwen.com/i16833129/f82ee7f532e44cda.png)
![](https://img.haomeiwen.com/i16833129/750bf45a801a5f89.png)
![](https://img.haomeiwen.com/i16833129/6cfeda639b44e94a.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
网友评论