elenapan/Scripts/inet.sh
elena e43cf1ccde updated scripts, added configs, new screenshot
Former-commit-id: 80e5a611d9
Former-commit-id: d6d963dd470140b7a955399ff22fec885ddace30
2017-08-29 02:28:24 +03:00

17 lines
No EOL
411 B
Bash
Executable file

# needs work! not thoroughly tested...
# Replace with your own interface names here
WIRELESS_IF="wlp3s0"
WIRED_IF="enp2s0f0"
WIFI="$(ifconfig | grep -A 1 $WIRELESS_IF | grep "inet" | awk '{print $2}')"
ETHER="$(ifconfig | grep -A 1 $WIRED_IF | grep "inet" | awk '{print $2}')"
if [ ${#ETHER} -eq "0" ]; then
if [ ${#WIFI} -eq "0" ]; then
echo "  "
else
echo "$WIFI"
fi
else
echo "$ETHER"
fi