add the shebang and parametters -v -V -h

This commit is contained in:
primardj 2024-03-25 00:28:49 +00:00
parent fa651e0d8a
commit c332e9b32b

View file

@ -1,7 +1,7 @@
#!/bin/sh
# Script which control the network. Make the bridge, veth, dummy, brx alone without any help. # Script which control the network. Make the bridge, veth, dummy, brx alone without any help.
version="0.0.1" version="0.0.2"
usage="USAGE usage="USAGE
$(basename $0) [PARAMETTER] [COMMAND NAME] $(basename $0) [PARAMETTER] [COMMAND NAME]
@ -16,7 +16,8 @@ DESCRIPTION
PARAMETTER PARAMETTER
-h, --help Print this help message and quit -h, --help Print this help message and quit
-v, --version Print the installed version of $(basename $0) and quit -V, --version Print the installed version of $(basename $0) and quit
-v, --verbose Print more output for all actions.
NAME NAME
Is the name of the vm to open Is the name of the vm to open
@ -28,6 +29,29 @@ COMMAND
" "
echo "$usage" print_usage() {
echo "${usage}"
}
print_version() {
echo "$(basename $0) v.${version}"
}
# first, test if there is help, version, or verbose args.
for i in "$@"; do
case "$i" in
"-h" | "--help")
print_usage
exit 0
;;
"-V" | "--version")
print_version
exit 0
;;
"-v" | "--verbose")
set_verbose
;;
esac
done