Files
dwmblocks/dwmblocks_scripts/dwm_ipaddr

12 lines
257 B
Bash
Executable File

#!/bin/bash
eth="$(ip -4 addr show eth0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
wlp="$(ip -4 addr show wlan0 2>/dev/null | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
if [[ $(echo $eth | wc -c) -gt 1 ]]
then
echo "$eth"
exit;
fi
echo "$wlp"