From: Siraaj Khandkar Date: Fri, 27 Jul 2018 20:53:21 +0000 (-0400) Subject: Take prefixes of net interfaces from CLI options X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=7e99089810096ff939fc243f1f7416469235d5cf;p=khatus.git Take prefixes of net interfaces from CLI options --- diff --git a/bin/khatus_show b/bin/khatus_show index 12263e1..b0b87a9 100755 --- a/bin/khatus_show +++ b/bin/khatus_show @@ -6,7 +6,7 @@ BIN=$HOME/bin STATUS_DIR=$HOME/var/run/status STATUS_FILE__WIFI=$STATUS_DIR/wifi STATUS_FILE__ENERGY_NOTIFIED_BELLOW_HALF=$STATUS_DIR/notified_energy_bellow_half -while getopts ":b:d:s:" opt +while getopts ":b:d:s:i:" opt do case "$opt" in b) @@ -18,6 +18,9 @@ do s) DISK_SPACE_DEVICE="$OPTARG" ;; + i) + PREFIXES_OF_INTERFACES_TO_SHOW="$OPTARG" + ;; \?) echo "Unknown option: $OPTARG" >&2 exit 1 @@ -127,7 +130,7 @@ network=$( ip -s addr \ | awk \ -v wifi_conn="$(cat $STATUS_FILE__WIFI)" \ - -v prefixes_of_interfaces_to_show='w' \ + -v prefixes_of_interfaces_to_show="$PREFIXES_OF_INTERFACES_TO_SHOW" \ ' BEGIN { bytes_per_unit = 1024 * 1024