`ip` takes a --oneline arg to make it more parseable.
`ip` takes a --oneline arg to make it more parseable.
The only real gripe I have with IP is their long argument/switch format. Unlike everyone else, ip is a minority, which accepts long options with single dash "-". This prevents someone from combining many short parameters under a single dash, also it's confusing to use.
Yes, it unofficially supports the old double dash format, but if you are supporting it, there's no point in supporting single dash long options.
The flags that a UNIX command uses can sometimes used to carbon-date that command. For example, dd(1) doesn't use a dash at all, uses long args, and uses an equals-sign to connect a flag with its argument (e.g. `dd if=/dev/null`). It's because dd(1) was written in the dawn of UNIX, before a convention was established for flags.
I believe the first step in creating a convention was the introduction of the getopt(3) library, which introduced single dash, single character options (e.g. `tar -x`). Commands that only have short options tend to be old commands.
Later, GNU introduced getopt_long(3), which allowed for long options and double-dashes to distinguish them from the short ones. This made commands more readable.
There have also been cases where the `-` is optional. `tar xvf` for example. And with the `ps` command, the `-` is used to distinguish BSD flags from System V flags (e.g. `ps auxwww` vs. `ps -elf`).
There has also been a movement for subcommands rather than options (which bring to mind the Cisco CLI), of which `ip` is an excellent example: `ip route show`. But subcommands are not a substitute for options; sometimes you need both (e.g. `ip -6 route show`).
All this goes to show that, although long options are quite common, they are not only game in town, and UNIX commands have a rich and varied set of conventions.
Old versions of sort used a + to begin some options. So yes, there has been a lot of variation over time, but I see no reason to gratuitously diverge from the common standards now in use, unless following them is too restrictive in some way.
Extreme flexibility becomes a burden after a certain point if it lacks adaptability.
Standards are built for these reasons.
For the `find` command the single dash is for predicates not for options (not that it makes a whole lot of difference)
You'll find them in ex-Bell labs people (e.g. go-lang) and associated (docker).
The double dash was born in the 90s; there was a poll on Usenet gnu.misc (or similar). Those who did not habituate usenet didn't get the memo.
gcc uses single dash for long options too: -std, -pedantic, -dumpspecs, etc.
I am sure there are many more modern commands that do this.
Neither are for 'dd' or 'tar' (probably 30 YO) from the other comment.
There are probably other, younger commands not following the --long-option pattern, but i think that doesn't make it better to break this convention.
Not all subcommands support it though.
rascul@coyote:~$ ip -json addr
Option "-json" is unknown, try "ip -help".
rascul@coyote:~$ ip -V
ip utility, iproute2-ss160111https://git.kernel.org/pub/scm/network/iproute2/iproute2.git...