#!/usr/bin/bash # #by fuxiaoshun 3/30 read -p "请输入域名:" name time=`date +%F:%H:%M:%S` ping -c1 $name if [ $? -eq 0 ];then echo "已通过,请查看/tmp/1.txt" echo "通过时间已经记录" $time >>/tmp/1.txt else echo "不通过,请检查网络" fi