标签:bsp dev color nbsp 图片 pre width height 定义变量
#!/usr/bin/bash
ip=115.239.210.27
if ping -c1 $ip &>/dev/null ;then # &>/dev/null: output of ping $ip is null
echo "$ip is up."
else
echo "$ip is down."
fi
#!/usr/bin/bash
read ip
ping -c1 $ip &>/dev/null
if [ $? -eq 0 ]; then
echo "$ip is up."
else
echo "$ip is down."
fi
#!/bin/bash
ping -c1 $1 &>/dev/null
if [ $? -eq 0 ]; then
echo "$1 is up."
else
echo "$1 is down."
fi
echo "ip1 is $ip1" echo "ip2 is $ip2"
(ip2 是环境变量)
标签:bsp dev color nbsp 图片 pre width height 定义变量
原文地址:https://www.cnblogs.com/douzujun/p/10361832.html