#!/bin/bash
while true
do
load=w|head -1|awk -F 'load average: ' '{print $2}'|cut -d. -f1
#将系统负载复制到load变量中
if [ KaTeX parse error: Expected 'EOF', got '#' at position 91: … #̲当load大于10 th…load"
#发邮件
fi
sleep 30
#30秒查一次
done
[root@allen shell]# uptime
14:29:13 up 5:33, 2 users, load average: 0.00, 0.01, 0.05
[root@allen shell]# w
14:29:25 up 5:33, 2 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 08:56 5:33m 0.01s 0.01s -bash
root pts/0 admin.innet.com 08:57 5.00s 0.17s 0.00s w
#!/bin/bash
while :
do
read -p "Please input a number: " n
if [ -z “$n” ] #变量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