From ba480949ccd5f00f9cfdcae15b67ffb895965833 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 25 Feb 2018 21:27:13 +0100 Subject: moved to i3-gaps and i3blocks --- scripts/eth.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/eth.sh (limited to 'scripts/eth.sh') diff --git a/scripts/eth.sh b/scripts/eth.sh new file mode 100755 index 0000000..2fb8b30 --- /dev/null +++ b/scripts/eth.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# dotfiles -- scripts/eth.sh +# author: johannst + +if="${BLOCK_INSTANCE:-enp0s25}" +[[ ! -d /sys/class/net/${if} ]] && exit 0 + +# operstate: down, up +[[ "$(cat /sys/class/net/$IF/operstate)" = 'down' ]] && exit 0 + +# first ipv4 addr +IP_ADDR=$(ip address show $if | grep 'inet ' | sed 's/\s\+inet \([0-9.]\+\)\/.*/\1/') + +echo "$IP_ADDR" + -- cgit v1.2.3