Why Unix Shell Syntax Sucks

By Xah Lee. Date: . Last updated: .

Unix Syntactical and Semantical Stupidity Exposition

arguments are given with a dash prefix. example

ls -a -l

Order does not matter (USUALLY!!). So,

ls -a -l

is the same as

ls -l -a

but arguments can be combined, example

ls -al

means the same thing as

ls -a -l

However, some option consists of more than one character. example

perl -version
perl -help

therefore, the meaning of a option string "-ab" is ad hoc dependent on the program. It can mean two parameters “a” and “b”, or just one parameter named "ab".

Then, often there are two versions of the same optional argument. example

perl -help
perl -h
perl -version
perl -v

this equivalence is dependent for each program.

Different program will disagree on common options. For example, to get the version, here are common varieties:


sometimes v/V stands for "verbose mode", i.e. to output more detail.

Sometimes, if a option is given more than once, then it specifies a degree of that option. For example, some command accept the -v for "verbose", meaning that it will output more detail. Sometimes there are few levels of detail. The number of times a option is given determines the level of detail. , for example: on Solaris 8,

/usr/ucb/ps -w
/usr/ucb/ps -w -w

Thus, meaning of repeated option may have special meaning depending on the program.

Oftentimes some options automatically turn on or surpress a bunch of others. For example, Solaris 8,

/usr/bin/ls -f

When a named optional parameter is of a boolean type, that is a toggle of yes/no, true/false, then, often, instead of taking a boolean value, their sole existence or non-existence define their value. (this is a confusion/infusion of named parameter and optional parameter)

Toggle options are sometimes represented by one option name for yes, while another option name for no. And, when both are present, the behavior is program dependent.

For named options, the syntax for arguments is inconsistent. Some program uses one syntax variation, others require another, some accept more than one syntax variations, for others it's syntax error. example

command -o="myvalue"
command -omyvalue
command -o myvalue

Often one option may have many synonyms…

A example of a better design… (Mathematica, Scheme, Dylan, Python, Ruby… there's quite a lot elegance and practicality yet distinct designs and purposes and styles …)

(recall that unix is a bad design to begin with; it's a donkey shit pile from the beginning and continuation. Again, unix is not simply technically incompetent. If that, then that's easy to improve, and i don't have a problem with, since there are things in one way or another considered horrendous by today's standard like COBOL or FORTRAN or DOS etc. But, unix is a brain-washing idiot-making machine, churning out piles and piles of religiously idiotic and pigheaded keyboard punchers. For EVERY aspects of good engineering methodology improvement or language design progress opportunity, unixers will unanimously turn it down.)

Inevitably someone will ask what's my point. My point in my series of unix-showcasing articles have always been clear for those who study it: Unix is a crime that caused society inordinate harm, and i want unix geeks to wake up and realize it.

above is originall posted to a Mac OS X mailing list. [Source http://www.omnigroup.com/mailman/archive/macosx-talk/2002-June/066077.html ]

From: xah@xahlee.org
Subject: unix inanity: shell env syntax
Date: June 7, 2002 12:00:29 AM PDT
To: macosx-talk@omnigroup.com

Unix Shell Syntax Idiocy Example: ps Command

One good example of the confuse ball in a single command can be seen in the ps command. In Solaris and BSD, typically you type ps auwwx (note, dash not allowed.) In POSIX unix, you type ps -ef. In linux, it tries to merge both syntax. See man ps.

linux ps manpage 2019-07-26 54js8
linux ps manpage 2019-07-26
bsd ps manpage 2019-07-26 4bv9m
bsd ps manpage 2019-07-26

GNU Double-Dash Syntax, 1990s

Note, in 1990s, the GNU introduced the double-dash syntax, in hope to make unix commands more readable. For example,

emacs --no-init-file

Unfortunately, it didn't really catch on. Most commands today do offer the double-dash variant, but only for some options. The double-dash option does not necessarily mean there's a corresponding single-dash one, and vice versa. The end result is just more syntax jumble.

Unix Shell Syntax History, 2000 to 2013

as of , the unix shell tool syntax have gone thru more evolution.

during 2000s, a new syntax form became popular, one that has a Action or Verb keyword immediately following the command name. Here are some prominent examples:

apt-get install --simulate -y name
Note this line contains 3 elements of syntax: dashless action positional argument, double dash, single dash, and the main argument for the verb name is placed at the end. [see Linux: How to Install/Remove Packages ]

git add -m"some" fpath
[see Git Basics ]

iptables --table filter --append INPUT --jump DROP
Note this command has a main dish, that is the --table filter, which specifies which table to act on. It is not a verb nor action. [see Linux: Firewall, iptables Tutorial]

Microsoft PowerShell

Note: Microsoft's new shell programing language, PowerShell (), adopted much of unix shell's syntax and the pipe paradigm, but with consistent design.

[see PowerShell Tutorial]

Unix Shell