You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
266 B

4 years ago
function ifup {
if [[ ! -d /sys/class/net/${1} ]]; then
#printf 'No such interface: %s\n' "$1" >&2
return 1
else
[[ $(</sys/class/net/${1}/operstate) == up ]]
fi
}
if ifup $1; then
echo Online
else
echo 'Not online'
fi