I found an answer here for a question on counting number of parameters passed argument to a BASH script. I'm interested on the line : ${1?"Usage: $0 ARGUMENT"} where it throws warning if no parameter is given.
Now I would like to invoke a usage function Usage using : ${1?"Usage: $0 ARGUMENT"} but I do not know how to do it. I tried : ${1?Usage} and BASH throws an error on this line. Can some suggest how to invoke a function using this.
The sample script is as below,
#!/bin/bash
function Usage() {
    echo "Usage: $0 [-q] [-d]"
    echo ""
    echo "where:"
    echo "     -q: Query info"
    echo "     -d: delete info"
    echo ""
}
# Exit if no argument is passed in
: ${1?Usage}
while getopts "qd" opt; do
    case $opt in
        q)
            echo "Query info"
            ;;
        d)
            echo "Delete info"
            ;;
        *)
            Usage;
            exit 1
            ;;
    esac
done
 
     
     
    
