On 3/20/2017 3:32 PM, Carlos E. R. wrote:
On 2017-03-20 18:46, Brian K. White wrote:
Similarly, trying to have a program detect that "this looks like an option but it's in the middle of a bunch of filenames" and treat that like an error is idiotic. That is a perfectly useful option which exists for a reason, not by some oversight of those stupid blundering shell or getopt authors. It's intentional to be able to, for example, build a command line from a loop, which changes options as the loop goes along. opt file file opt opt file opt file...
No, I can not agree here.
It is impossible for the parser to differentiate between an option in the middle of the stream of file names, or a file that starts with a dash. it is ambiguous at best.
You neither agreed nor disagreed. You said something that is only true sometimes, and not true other times, and has no ultimate meaning and does not invalidate the statement that it's intentional and useful that you can build commandlines for most programs in any order you like. Filenames ARE options, and the parser absolutely does differentiate strings according to whatever rules a given program has defined. Those rules will necessarily be different for different programs, as different programs do different kinds jobs. And there are more kinds of arguments than just flags and filenames. There are urls and really any number of other special purpose syntaxes for example the difference between user@host:module and user@host::module for rsync. And there is no option for disagreeing that it's intentional and useful to be able to construct commandlines for most programs in arbitrary order. It simply is. It's like trying to argue that it's not useful to be able to specify either an absolute path or a relative path. If a filename happens to look exactly the same as some other option that happens to have some special meaning to the given program, it is up to the user to differentiate those one way or another. For example, simply specifying paths as "./* instead of "*" usually takes care of all such problems. And that example is really just akin to simply speaking with less ambiguity in general. If I tell you to pick up all the rocks, the ambiguity is my fault for not specifying which kind rocks from what defined area, not the English languages fault for allowing me to speak an ambiguous statement. -- bkw -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org