I was working my way through a primer on Shell (Bash) Scripting and had the following doubt :
My Question :
- What is the difference in
- Why are there 2 nomenclatures used ?
- What is the motivation behind it ?
Best How To :
--foo) options are a GNU extension -- something present in GNU
ls, but not present at all in the POSIX standard setting requirements for UNIX tools, so other versions of
ls are not obliged to support these options. The entire word (
foo) is meaningful in this case. This nomenclature was added more recently, and is more expressive than the short form (and doesn't have namespace limitations).
Short-form options (
-al) are, at least in form, standardized (though extensions can add new ones). They're handled character by character, one letter at a time -- so
-a (show hidden files) and
-l (long output), rather than having
-al have its own meaning in this case. This is the original syntax for UNIX command-line options, and is thus supported not only for terseness but also for backwards compatibility.