#!/bin/sh # stuff to try to explain getopts command line options # will echo out the flag used if used o.O # else just weeeeeeeee help() { echo "weeeeeeeeeeeeeeee"; exit 1; } [ $# -eq 0 -o $# -gt 256 ] && help for opt in $@; do case "${opt:0:2}" in --*) help;; esac; done while getopts c:vh OPT; do case "${OPT}" in c) opt="${OPTARG}";; v) echo "rAWWWRR" ;; h) help; exit 1;; *) help; exit 1;; esac; done [ -n $opt ] && echo "${0//*\//}: got opt=\"${opt}\"" exit 0 ~ ~ ~