From 423d3b24016754133d343bdec64f2eded2320606 Mon Sep 17 00:00:00 2001 From: hk Date: Fri, 13 Jan 2017 08:57:52 +0100 Subject: [PATCH] Add -V argument to print version --- src/tc-gen.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tc-gen.sh b/src/tc-gen.sh index 29fea70..71f1bbb 100755 --- a/src/tc-gen.sh +++ b/src/tc-gen.sh @@ -1,6 +1,7 @@ #!/bin/bash +VERSION="1.1.0" TC=$(which tc) ETHTOOL=$(which ethtool) IP=$(which ip) @@ -57,6 +58,8 @@ OPTIONS a ceil of 70 mbit/s and a priority of 2. -x Clear all traffic control config on interface. + -V + Print version and exit. EXAMPLES OF COMMON USE Shape egress to 25 mbit/s @@ -118,6 +121,10 @@ EXCLUDE TRAFFIC FROM INGRESS FILTERING EOF } +print_version () { + echo "tc-gen.sh v${VERSION}" +} + get_htb_quantum () { # Takes input rate in mbit/s as parameter local RATE=$1 @@ -357,7 +364,7 @@ apply_ingress_policing () { # All rates should be given in mbit/s -while getopts ":i:u:d:b:f:q:c:x" OPT; do +while getopts ":i:u:d:b:f:q:c:xV" OPT; do case $OPT in i) IF_NAME="${OPTARG}" @@ -380,6 +387,10 @@ while getopts ":i:u:d:b:f:q:c:x" OPT; do x) CLEAR_CONFIG=1 ;; + V) + print_version + exit 0 + ;; \?) print_usage exit 1