Another simple example in bash (if you do not care about the switches' names) :
Code:
#!/bin/bash
parseArguments() {
if [[ $# -lt 3 ]]; then
echo "Usage: $0 host user pass"
exit 1
fi
host="$1"
user="$2"
pass="$3"
# do you stuff here, and put the following at the main part of the script :
parseArguments() $@
The $0 is the name of the script.