while getopts htn: OPTION
do
        case ${OPTION} in
                t)  LIST='john mike smith' ;;
               n) LIST='rob peter joe' ;;
               h|*)  show_usage
                     exit 0
                     ;;
        esac
done
shift $(($OPTIND - 1))
args=$*

above is a snippet of code. i would like to use more than one character in my options e.g fname lname should count as 2 options instead of "while getopts htn: OPTION"
would like something like "while getopts fname lname: OPTION
How do i get getopts to work in that form.

See: http://www.mail-archive.com/bug-bash@gnu.org/msg02546.html

I don't think getopts knows how to parse words as options (and not as non-GNU-style, certainly). You are probably better off writing your own parser, something like this:

while [ $1 ] ; do
        [ ${1:0:1} = '-' ] || break
        case ${1:1} in
                help) echo help;;
                c*)
                        if [ ${1:1} ] ; then arg=${1:1}
                        else shift; arg=$1
                        fi
                        echo "arg of -c is $arg"
                        ;;
                *)
                        echo "bad option, $1";;
        esac
        shift
done
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.