3 ms·
> When grouped, the option accepting an argument must be last ... program -abcooutput.txt Good grief, no. There may be some utilities out there which work thi
by kazinator 6y ago
> When grouped, the option accepting an argument must be last ... program -abcooutput.txt
Good grief, no.
There may be some utilities out there which work this way, but it is not convention and should not be regarded as one.
Single letter options should almost always take an argument as a separate argument.
Some traditional utilities allow one or more arguments to be extracted as they are scanning through a "clump" of single letter options:
-abc b-arg c-arg
Implementations of tar are like this.
Newly written utilities should not allow an option to clump with others if it requires an argument. Only Boolean single-letter options should clump.
Under no circumstances should an option clump if its argument is part of the same argument string. For instance consider the GCC option -Dfoo=bar for defining a preprocessor macro, and the -E option doing preprocessing only. Even if -Dfoo=bar is last, we don't want it to clump with -E as -EDfoo=bar --- and it doesn't.
But, in the first place, even if it did, we don't want to be looking to C compilers for convention, unless we are specifically making a C compiler driver that needs to be compatible.