#! /bin/bash
    declare  opt_char
    while getopts :xy:z opt_char; do
        case $opt_char in
           x) echo $opt_char found
              ;;
           y) echo $opt_char found with \"$OPTARG\"
              ;;
           z) echo $opt_char found
              ;;
           *) echo option error index $(( $OPTIND - 1 )) = \"$opt_char\"
              exit 1
              ;;
        esac
    done
    if (( $OPTIND > $# )); then
       echo All args have been processed
    else
        echo First non-dash arg is \$$OPTIND = \"$(eval echo -n \$$OPTIND)\"
    fi
    exit 0    
