codice:
#!/bin/bash

while getopts  "ab:c" option
do
  echo $option $OPTIND $OPTARG
done
vuol dire che lo script può avere tre opzioni di cui l'opzione -b deve avere un argomento. L'argomento lo ritrovi nella variabile ambiente $OPTARG mentre $OPTIND è l'indice del prossimo argomento soggetto al parser.

Provo lo script con
$./prova_getopts -ab "ciao mondo" -c
$./prova_getopts -a -b "ciao mondo" -c
$./prova_getopts -a -b "ciao mondo" -c -d

l'ultimo ti darà un errore dato che l'opzione d non è prevista.