[edited to add] As others have reminded me, there's also simply 'version'
[edited to add] As others have reminded me, there's also simply 'version'
$ java --version
Unrecognized option: --version
$ java -v
Unrecognized option: -v
$ java -version
openjdk version "1.8.0_312"
Looks like this was fixed in JDK 11.But Java isn't as sadistic as Go lang:
$ go --version
[scrolls off screen]
$ go --version | less
[scrolls off screen]
$ go --version 2>&1 | less
[search for 'version' command]
$ go version
go version go1.17.2 linux/amd64(might be really buggy, let me know)
-v for basic verbose
-vv for more
-vvv for even more
-vvvv oh come on you've got to be kidding
-vvvvv nope, they're not kidding
Just assessing expectations because I do like the idea and would implement it (in addition to the expected way) next time it comes up
I suppose you could really take it to some absurd level with -v¹⁰ for -vvvvvvvvvv
So (-iv)² = -vv and once you've escaped the brackets in bash all is good.
I think we're on to something here....
-vv ⇒ -w
-vvvv ⇒ -ww
Just a joke :)I usually assume that lower-case 'v' is for verbose.
Except Java 17. Java 17 went to `java --version`. And `java -version` doesn’t work anymore (Yes I jumped from Java 8 to 17, but most people did).
$ mawk --version
mawk: not an option: --version
$ mawk --help
mawk: not an option: --help
$ mawk -W version
mawk 1.3.4 20200120
Copyright 2008-2019,2020, Thomas E. Dickey
Copyright 1991-1996,2014, Michael D. Brennan
random-funcs: srandom/random
regex-funcs: internal
compiled limits:
sprintf buffer 8192
maximum-integer 2147483647
And mawk is (was in 16.04 at least) the default version of awk on Ubuntu. How is the user supposed to know this magic incantation? ¯\_(ツ)_/¯(Honestly I’d rather not have the convention of programs themselves handling this at all and instead have this be `ident awk` or similar, but I understand this is not going to happen.)
$ java -version
openjdk version "18" 2022-03-22
OpenJDK Runtime Environment Temurin-18+36 (build 18+36)
OpenJDK 64-Bit Server VM Temurin-18+36 (build 18+36, mixed mode, sharing)java -D-version
"-v, --invert-match"
62 characters is not a lot for tools that have a lot of settings.
In the case of tools like grep, the settings are really more of a command vocabulary, and should rightly be written in their own language in a script file, like sed and awk, but grep makes some especially commonly needed ops available as a simpler command with switches for convenience. And that results in some seemingly arcane and inconsistent commandlines.
Defining how to search for something is just not a simple 2 or 3 options covers it kind of job.
By contrast, another tool with the same problem but clearly originated from a different starting idea is 'find'. It also has to have essentially a vocabulary to express your intentions in composed sentences, and it ends up with a mix of switches and words.
With some apps it's damn near impossible to query the version, especially cross platform. I used to manage a database of that syntax with a tool called "specs".
-p is for PID file
-l is for log file
-v is for version
-L is for verbosity level (e.g.: -L debug)
-c is for config file (where all the other options may be specified instead)
-h is for help
The rest are context-specific.