-rw-r--r--. 1 root root 42 Apr 29 22:02 ip.text
[root@localhost ~]# cat ip.text
192.168.10.10
192.168.10.20
192.168.10.30
[root@localhost ~]# cat haha.sh
#!/bin/bash
#this is my first script
for IP in `cat ip.text`
do ping -c 3 -i 0.2 -W 3 $IP &> /dev/null
if [ $? -eq 0 ]; then
echo "Host $IP is online"
else echo "Host $IP is off-line"
fi
done
[root@localhost ~]# ./haha.sh
Host 192.168.10.10 is online
Host 192.168.10.20 is off-line
Host 192.168.10.30 is off-line
[root@localhost ~]#
[root@localhost ~]# cat hehe.sh
!#/bin/hash
###
read -p "Enter:" KEY
case $KEY in
[a-z]|[A-Z])
echo "zimu"
;;
[0-9])
echo "shuzi"
;;
*)
echo "luanma"
esac
[root@localhost ~]#
at:在特定时间执行
Ctrl+d
at -l:显示当前的计划任务
at -c 1
查看第一个计划任务
at -c 1
at -l
atrm 1
分,时,日,月,命令