delete bad whitespace, work on ip

This commit is contained in:
koksnuss
2018-05-31 17:07:51 +02:00
parent 2ce66de19b
commit 4ffb6fc5d3
3 changed files with 11 additions and 11 deletions

View File

@ -1,23 +1,23 @@
#!/bin/bash #!/bin/bash
#TODO check if at least one device is UP when running "ip addr" in the <> brackets
if [[ -n "$BLOCK_INSTANCE" ]]; then if [[ -n "$BLOCK_INSTANCE" ]]; then
IF="$BLOCK_INSTANCE" IF="$BLOCK_INSTANCE"
else else
IF=$(ip route | awk '/^default/ { print $5 ; exit }') IF=$(ip route | awk '/^default/ { print $5 ; exit }')
fi fi
if [[ ! -d "/sys/class/net/$IF" ]]; then if [[ "$IF" == "" || ! -d "/sys/class/net/$IF" ]]; then
echo " no network interface " echo "off"
echo "not found" echo "X"
echo "" echo ""
exit 33 exit 33
fi fi
echo $IF
WAN_IP=$(curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//') WAN_IP=$(curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//')
LAN_IP=$(ip addr | gawk '/ LAN_IP=$(ip addr show "$IF")
#TODO show connection
echo "$IP" echo "$IP"
echo "$IP" echo "$IP"
echo "" echo ""