#! /bin/bash wireless="wlan0" lan="lan0" wup=$(ethtool $wireless 2>/dev/null| grep -oP "Link detected:.*") lup=$(ethtool $lan 2>/dev/null| grep -oP "Link detected:.*") for i in "$wireless" "$lan"; do echo "$wup" | grep "yes" #if [ $(echo "$wup" | grep "yes") = "" ]; if [ "$wup" = "" ]; then echo 1 fi; done;