3 ms·
I wouldn't call Bash a "language" per se... Bash is a user interface, first and foremost. Bash "scripting" is literally just the running of Bash shell commands
by throwaway984393 5y ago
I wouldn't call Bash a "language" per se... Bash is a user interface, first and foremost. Bash "scripting" is literally just the running of Bash shell commands in bulk. But every language does have people making the same complaints. Every language has quirks. Every language has obscure syntax (if you haven't found it yet, you just haven't used it enough...). Every language has people say either "There's no type checking!", or "It forces type checking!". And there are absolutely return values, they're just either integers or raw data on standard output. But the point is, it's not supposed to be a "good programming language". It just has to be more useful than manually typing in shell commands one at a time.
You're right about them needing to be short. Ideally every program should be short. But scripts are especially supposed to be short, because they're never supposed to get complex (or be fast/efficient); that's when you need a "real" program. Even the bottom of the Bash man page says about itself: "BUGS: It's too big and too slow."
(fwiw, back in the day we didn't use linters, we just had to write it all correctly the first time. punch card typos are a memorable lesson in checking your work)
- pizza234 5y agoIt's technically a glue language, and can be considered a language due to the constructs it provides (e.g. arrays and hash maps). The fact that every language has a variable amount of a certain property doesn't mean that the amount is the same for all the languages. The amount of domain knowledge required for simple programs is considerably higher in Bash, than any related language; even iterating the lines of a string can be unintuitive to casual users. Bash is weakly typed, and weak typing is considerably unsafe (bug-prone) than any other related language (e.g. Python, which is has taken has share of shell scripting in modern operating systems). Returning values via stdout is a workaround. If other parts of the function send messages to stdout, one needs to use a combination of redirects, which the vast majority of the programmers don't know. Calling the ability to return a value from 0 to 255 support for return value is a big stretch. I think that Bash is a necessity, and I frequently use it (and it's fun-ish for small scripts), but it definitely doesn't fit the definition of "easy", being considerably more error-prone and unintuitive to any comparable language, possibly even when compare to Perl.
- throwaway984393 5y agoPerl and Bash are only "error-prone and unintuitive" in the way that woodworking is. If you have no education into how it all works, and you just take a saw or drill to a bunch of wood and try to hack together a table, the result will be terrible. You need to read something that explains how it works, then practice it and make some mistakes to learn from. The same thing is true of C, C++, Lisp, Haskell, all sorts of languages. Nobody just uses them perfectly on the first try.