User Tools

Site Tools


posix_shell_getpots

This is an old revision of the document!


Overview

Starting points

First, there has been much blood spilled discussing how to support optional arguments using getopts – the correct solution is to not do that, as explained in Guideline 7 here. So we won't.

And, second, if the optstring handed to getopts starts with a colon, then getopts uses what is called “silent error reporting”; this appears to be the recommended approach, so we'll stick with that. In short, don't do this:

while getopts ab:c: opt ; do

Do this:

while getopts :ab:c: opt ; do

Explanation below.

posix_shell_getpots.1569841425.txt.gz · Last modified: 2019/09/30 11:03 by rpjday