Add -V argument to print version

This commit is contained in:
hk 2017-01-13 08:57:52 +01:00
parent 46a4125980
commit 423d3b2401
1 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
VERSION="1.1.0"
TC=$(which tc) TC=$(which tc)
ETHTOOL=$(which ethtool) ETHTOOL=$(which ethtool)
IP=$(which ip) IP=$(which ip)
@ -57,6 +58,8 @@ OPTIONS
a ceil of 70 mbit/s and a priority of 2. a ceil of 70 mbit/s and a priority of 2.
-x -x
Clear all traffic control config on interface. Clear all traffic control config on interface.
-V
Print version and exit.
EXAMPLES OF COMMON USE EXAMPLES OF COMMON USE
Shape egress to 25 mbit/s Shape egress to 25 mbit/s
@ -118,6 +121,10 @@ EXCLUDE TRAFFIC FROM INGRESS FILTERING
EOF EOF
} }
print_version () {
echo "tc-gen.sh v${VERSION}"
}
get_htb_quantum () { get_htb_quantum () {
# Takes input rate in mbit/s as parameter # Takes input rate in mbit/s as parameter
local RATE=$1 local RATE=$1
@ -357,7 +364,7 @@ apply_ingress_policing () {
# All rates should be given in mbit/s # 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 case $OPT in
i) i)
IF_NAME="${OPTARG}" IF_NAME="${OPTARG}"
@ -380,6 +387,10 @@ while getopts ":i:u:d:b:f:q:c:x" OPT; do
x) x)
CLEAR_CONFIG=1 CLEAR_CONFIG=1
;; ;;
V)
print_version
exit 0
;;
\?) \?)
print_usage print_usage
exit 1 exit 1