H.Merijn Brand skribis 2006-05-25 21:43 (+0200):
> > ju...@nano:~$ perl -?
> > Unrecognized switch: -? (-h will show valid options).
> > ju...@nano:~$ vi -?
> > VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Apr 28 2006 01:45:37)
> > Unknown option: "-?"
> > More info with: "vim -h"
> > ju...@nano:~$ python -?
> > Unknown option: -?
> > usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
> > Try `python -h' for more information.
> > ju...@nano:~$ ruby -?
> > ruby: invalid option -? (-h will show valid options)
> All GNU, as Philip said.
GNU Perl?
GNU VIM?
GNU Python?
GNU Ruby?
> Look, here is a genuine old awk and sed :)
> d3:/usr/bin 113 > awk -?
> Usage: awk [-F fs][-v Assignment][-f Progfile|Program][Assignment|File] ...
> d3:/usr/bin 114 > sed -?
> Usage: sed [-n] [-e script] [-f source_file] [file...]
Interesting that they don't list -? in the usage information. What do
these awk and sed do if you run
awk -@
sed -@
If they then too give usage info, -? isn't a feature, but a useful side
effect.
> d3:/usr/bin 133 > metamail -?
How about
metamail -@
> d3:/usr/bin 134 > elmalias -?
elmalias -@
> d3:/usr/bin 142 > rup -?
> Usage: rup [-h] [-l] [-t] [host ...]
rup -@
> d3:/usr/bin 147 > jobs -?
> Usage: jobs [ -l ].
jobs -@
> No, I didn't, but I proposed a change to perl a very long time ago, and I
> still don't understand why it was turned down.
I do, especially after reading this thread.
> > So that's about 60 programs that do support -?, against over 1200 that
> > do not. Sanity wins!
> Again, you're in a GNU environment.
OpenBSD 3.2, not quite a GNU environment:
$ ls -?
ls: illegal option -- ?
usage: ls [-1ACFLRSTWacdfiklmnopqrstux] [file ...]
$ grep -?
grep: invalid option -- ?
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
$ mv -?
mv: illegal option -- ?
usage: mv [-fi] source target mv [-fi] source ... directory
$ vi -?
vi: illegal option -- ?
usage: ex [-eFRrSsv] [-c command] [-t tag] [-w size] [file ...]
usage: vi [-eFlRrSv] [-c command] [-t tag] [-w size] [file ...]
$ mkdir -?
mkdir: illegal option -- ?
usage: mkdir [-p] [-m mode] dirname ...
Blaming GNU is too easy.
> Now, come up with a good reason why -? should not map to --help
Oh, I'm not arguing that -? shouldn't be supported. I am arguing that
expecting that it is supported, is rather silly. I am also warning that
using -? may be unsafe, and that -h or --help is more likely to work
anyway.
Supporting -? and documenting it is bad, though, because of
aforementioned security risks and because people might come to expect
-? to work from other applications.
> -? as an alias for --help makes sense. I ask for help: just give it.
I'll give you help info, but only because you're feeding me something I
don't understand. Not because I think "?" looks like "help". It looks
more like "huh?", but that isn't something I'd shout when drowning.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html