I have created a script in order to use arguments while running that script. How to check if there were no arguments provided ? It must shows print help if no argument passes.
while test -n "$1"; do case "$1" in -help|-h) print_help exit $ST_UK ;; --version|-v) print_version $PROGNAME $VERSION exit $ST_UK ;; --activeusers|-a) opt_var=$2 au shift;; --dailyusers|-d) opt_var1=$2 dau shift;; *) echo "Unknown argument: $1" print_help exit $ST_UK ;; esac shift done
(( $# )) || print_helpthe the top of your script