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