From 7c71b8b614f18f0c98ac3086bd97a94b7cfae7ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Tue, 21 Nov 2023 07:34:08 +0100 Subject: [PATCH] Automatically find network interfaces. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolás Ortega Froysa --- status-update | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/status-update b/status-update index 20ec9b8..68e3682 100755 --- a/status-update +++ b/status-update @@ -1,7 +1,18 @@ #!/bin/sh +for ifname in $(ls /sys/class/net/ | grep -v 'lo') +do + if ! [ -f "/sys/class/net/$ifname/operstate" ] + then + >&2 echo "$ifname has no operstate" + continue + fi + IF_STATUS=$(cat /sys/class/net/$ifname/operstate) + IF_STATE_LIST+=("$ifname: $IF_STATUS") +done + DATE="$(date +"%F %H:%M" )" -NETWORK="eth: $(cat /sys/class/net/enp34s0/operstate)" +NETWORK="${IF_STATE_LIST[*]}" SPACE="$(cat $HOME/.cache/free-space)" vol_status="$(cat $HOME/.cache/audio-control/vol_status)" vol_level="$(cat $HOME/.cache/audio-control/vol_level)%"