You mentioned "option" in a comment, which made me think maybe you are trying to parse command line options. Since the POSIX getopts utility can't parse "long options", like --test or --example, we can ask GNU getopt to parse them for us instead.
The following is a shell script that takes the short options -e and -t, and the corresponding "long options" --example and --test. The long options may be specified on the command line as any prefix string of the full option string, e.g. --e, --ex etc. would all resolve to --example. In the code below, the --test/-t option takes a mandatory argument, signified by the trailing : after the corresponding long and short option string.
GNU getopt (part of util-linux) is used for parsing the command line.
#!/bin/sh
opts=$( getopt -o et: -l example,test: -- "$@" )
if [ "$?" -ne 0 ]; then
echo 'Error in getopt' >&2
exit 1
fi
eval set -- "$opts"
unset opts
unset testarg
while true; do
case "$1" in
-e|--example)
echo 'Example option'
shift
;;
-t|--test)
echo 'Test option'
testarg=$2
shift 2
;;
--)
shift
break
;;
*)
echo 'Command line parsing error' >&2
exit 1
esac
done
if [ -n "$testarg" ]; then
printf 'Test argument = "%s"\n' "$testarg"
fi
Testing:
$ ./script -e
Example option
$ ./script --exa
Example option
$ ./script --exa -t hello
Example option
Test option
Test argument = "hello"
$ ./script --exa --te='hello world'
Example option
Test option
Test argument = "hello world"
$ ./script -et 'hello world'
Example option
Test option
Test argument = "hello world"
$ ./script -eethello
Example option
Example option
Test option
Test argument = "hello"