This question already has an answer here:
- What exactly is POSIX? 4 answers
I've been doing some shell scripting.
It always gives me a headache. Clearly this language has evolved organically, much as real life languages; new constructs have been dynamically added, constantly introducing new rules and complexities.
Here is an example:
I understand that people like to avoid polluting the variable namespace; hence the function and the local part, which in turn forces the use of double quotes, which in turn forces the need to double up some but not all backslashes (and to know which ones -- oy!). I find that unnecessarily complicated. Granted, there's a tiny risk of collision if someone overrides BLUE or whatever, but on the other hand, the double-quote solution also carries the risk that a terminal will have backslashes in its escape sequences. And since the contents of the escape sequences are being parsed in the double-quote solution, but not in the single-quote solution, such a terminal could mess things up. Example of the difference:
taken from http://mywiki.wooledge.org/BashFAQ/053
It is common to find this level of complexity in technical conversations about shell scripting.
Also there exist a multitude of different shells with subtle syntactic differences.
If a group of experts started from scratch, I bet they could come up with a universal shell scripting language that was much easier to learn, understand and program.
Just as a group of C experts planned C++, or C++ -> C#
There is an ANSI C standard, but is there something similar for shell scripting?
Might it be possible to construct an intermediate shell language, that can expand to various shells?
Is there any effort in this direction, or are we just stuck with things the way they are, like the QWERTY keyboard?