On Tuesday 22 March 2016, Stephane CHAZELAS wrote: > 2016-03-22 12:31:50 -0700, Paul Eggert: > [...] > > > It might be helpful to have some other environment variable that > > meant "try to be strict about supporting only behavior required by > > POSIX", as one could use that to develop shell scripts that were > > more portable. However, that would be a lot of work to implement, > > and it's not clear it's worth the hassle to develop, maintain, and > > document. Plus, POSIX does not always specify behavior, so > > portability wouldn't be guaranteed by this. > > But then in that environment, true --help would report an error: > > true: no argument allowed > > and exit with a non-zero exit status like when other non-POSIX > extensions are not supported. It wouldn't make true more POSIX > conformant but it would help people write POSIX scripts by > telling them the feature they rely on (true ignoring arguments) > is not standard. > > The OP's request was primarily about increasing portability with > other true implementation where in "true --help", the "--help" > argument is ignored. > > I agree POSIX true doesn't accept arguments, but before GNU > "true" started accepting --help, --version, you could do > portably (if not standardly): > true "$args" to be ignored
Frankly the only sane implementation of true(1) is IMO a main function which does nothing but return 0. Actually I was shocked then I saw coreutil's true.c today. Why on earth would somebody use getopt and locale machinery to implement the POSIX specification of true? Anyways I give up, GNU-Style-Conventions seem to be much stronger than any common sense. Don't get me wrong I really like --help and --version for real programs and I respect that coreutils did a good job to add these options strictly to all their progs. But for true and false? How could the true's version be interesting for somebody since there does only one sane true.c exist? PS actually my personal issue with true is not really that I want to use it with options. I was simply looking for a minmal binary, available on any systems. Unfortunately true is not and will never be. cu, Rudi