Why Unix Shell Syntax Sucks

By Xah Lee. Date: . Last updated: .

Bad Designs of Unix Shell Syntax and Semantics

Ambiguity of Parameter Names

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".

Inconsistent Parameter Names

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.

Inconsistent Semantics of Repeated Parameters

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.

Complex Relation of Parameters

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

/usr/bin/ls -f

Inconsistency of Boolean Parameter Syntax

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.

Inconsistency of Parameter Value Syntax

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

Often one option may have many synonyms.

Examples of Better Design

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

Unix Shell Syntax History

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.

Unix Shell

Why UNIX sucks series