• cmullican - Monday, March 4, 2019 3:44 PM

    I should unpack that a little more. The fundamental Unix conventions were established in the 1960s and 1970s, when computers were far more limited in CPU, memory, and network bandwidth.  Every keystroke counted; being able to type 'ls -slApF' instead of 'ls -s -l -A -p -F' was a significant savings in time and resources (nevermind 'ls --size -l --almost-all --indicator-style=slash --classify', which wasn't even an option in the early days!). Was it hard to read?  Sure, but it worked!  Cheat sheets were common, but any command one used frequently became second nature, plus 'alias' let you encapsulate a longer command in a short string.

    Over time, as bandwidth increased and other resources became more plentiful, readability and memorability became bigger concerns, and some commands started running out of single letters that were in use, especially letters that had any connection to the parameter.  But breaking everything that used the original format -- including user habits -- would be a really bad idea, so the -- predicate for multi-character parameters was introduced.  The most commonly used options still have short names for efficiency; less-common options may only have a long name, and many options have both, because there's more than one way to do it, as Perl programmers say.

    I'm oversimplifying a bit -- other conventions have been used and sometimes still are; some tools use a - for all parameters and don't allow combining, some use +/- to turn options on/off, etc. -- but that's the general idea.

    '/' is a directory separator in Unix, so it would not work well as a parameter predicate.

    I like using the convention of calling the -[char], --[keyword] etc switches or options, after all many commands have positional parameters too and it helps to keep them separate when putting together command lines. Obviously some switches have their own parameters too. I know thats probably just personal preference, but knowing that switches and parameters have a somewhat different meaning has helped me put together some working command lines with utilities that had lots of options and multiple parameters but will only offer something like "bad parameters" as a troubleshooting aid 🙂