commit aa3f46b5f086434c83688d01d248cf747a1a7a87
Author: randymcmillan <[email protected]>
Date: Wed Sep 6 12:32:21 2023 -0400
template/gnostr-iftop
diff --git a/template/gnostr-iftop b/template/gnostr-iftop
new file mode 100755
index 000000000..93756e649
--- /dev/null
+++ b/template/gnostr-iftop
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+#
+
+GNOSTR=$(which gnostr)
+
+function gnostr-geten0(){
+ifconfig en0 | grep --word-regexp inet | awk '{print $2}'
+DEVICE=$(ifconfig en0 | grep --color=auto --word-regexp inet | awk '{print $2}') ## && echo $DEVICE
+}
+function gnostr-geten1(){
+ifconfig en1 | grep --word-regexp inet | awk '{print $2}'
+DEVICE=$(ifconfig en1 | grep --color=auto --word-regexp inet | awk '{print $2}') ## && echo $DEVICE
+}
+
+gnostr-iftop-help(){
+
+echo Try:
+echo gnostr-iftop
+echo gnostr-iftop -i en0
+echo gnostr-iftop -i en1
+
+}
+function gnostr-iftop (){
+
+ [ ! -z "$1" ] && \
+ sudo /usr/local/sbin/iftop -i $1 2>/tmp/gnostr-functions.log | \
+ [ ! -z $(gnostr-geten1) ] && \
+ sudo /usr/local/sbin/iftop -i en1 2>/tmp/gnostr-functions.log || \
+ [ ! -z $(gnostr-geten0) ] && \
+ sudo /usr/local/sbin/iftop -i en0 2>/tmp/gnostr-functions.log || \
+ gnostr-iftop-help
+
+}
+gnostr-iftop