shell中的逻辑判断while

w|head -1|awk -F'load average: ' '{print $2}'|cut -d. -f1
#!/bin/bash while true do load=`w|head -1|awk -F'load average: ' '{print $2}'|cut -d. -f1` if [ $load -gt 10 ] then echo $load fi sleep 30 done
#!/bin/bash
while true
do
read -p "Please input a number:" n
if [ -z "$n" ]
then
echo "you need input sth"
continue
fi
n1=`echo $n|sed 's/[0-9]//g'`
if [ -n "$n1" ]
then
echo "you just only input numbers"
continue
fi
break
done
echo $n
本文来自博客园,作者:你好!2022,转载请注明原文链接:https://www.cnblogs.com/jzhg/p/8567596.html

浙公网安备 33010602011771号