# start firefox [[ "$BLOCK_BUTTON" == 3 ]] && firefox # get interface if [[ -n "$BLOCK_INSTANCE" ]]; then IF="${BLOCK_INSTANCE#long}" else IF=$(ip route | awk '/^default/ { print $5 ; exit }') fi # check if network interface is empty if [[ -z "$IF" ]]; then [[ $LONG ]] && echo "No interface" || echo "n/a" exit 33 fi # check if the network interface exists if [[ ! -d "/sys/class/net/$IF" ]]; then [[ $LONG ]] && echo "No interface" || echo "n/a" exit 33 fi # get interface information LAN=$(ip addr | grep -E "$IF") # check if interface is up if [[ "$LAN" =~ " UP " ]]; then # check if interface is connected if [[ "$LAN" =~ \<.*UP.*\> ]]; then WAN_IP=$(curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//') # check if internet connection is established if [[ "$?" -eq 0 && $WAN_IP != "" ]]; then if [[ $LONG ]]; then echo $WAN_IP echo $WAN_IP [[ $COLORS ]] && echo $COLOR[8] || echo $BW[8] else echo WAN echo WAN [[ $COLORS ]] && echo $COLOR[8] || echo $BW[8] fi else echo "lan" fi fi else [[ $LONG ]] && echo "$IF: off" || echo "off" fi