On Fri, November 13, 2015 1:02 pm, Dennis Williamson wrote:
> Your opts string needs to begin with a colon to enable silent error
> reporting and you need to handle the colon in your case statement as the
> condition where a required argument is missing.

Hi, Dennis - thanks for replying. I get the same behavior with silent
reporting. My real script where I discovered this behavior actually uses
silent reporting - I didn't use it in my example to keep things simple.

> Snippets:
>
>
> opts=:a:b:c
>
>
> :) echo "Missing argument for option -$OPTARG" >&2;;
>
>
> You should escape the question mark since otherwise it's a globbing
> character:

You are right! I missed that when throwing together my example script.

> \?) echo "Unknown option: -$OPTARG" >&2; exit 1;;
>
>
> --
> Visit serverfault.com to get your system administration questions
> answered.
>



Reply via email to