4 ms·
"Scripting" language is a misleading way to view Bash. It's a popular "command" language. PowerShell's language is another "command" language, but Bash is more
by shrimp_emoji 4y ago
"Scripting" language is a misleading way to view Bash.
It's a popular "command" language. PowerShell's language is another "command" language, but Bash is more popular than PowerShell due to its vastly longer history and Unix's superiority as a platform for technical work compared to Windows.
Other "scripting" languages (like Python or JavaScript or Ruby) are not drop-in replacements for Bash or PowerShell. You can do with Python what you should do with Bash (such as a nightly system maintenance script or a script that installs a program on your system), but it will be more work (assuming you've already paid the not-insignificant upfront cost to learn Bash). Bash directly interfaces with the system shell in ways Python cannot and was not meant to. Python's a general-purpose scripting language, meant for general work on any system, while Bash was designed to be your gateway to the Bash shell (the terminal) for your Unix system, same as PowerShell for Windows.
Arguably, on the flip side, that's why it's so horrible for general purpose work compared to Python. Making a Space Invaders game in Python? Great. In Bash? Morbidly cool but horrible.
There are Python-based shells for Linux, for example, but I don't think Python can ever be as ergonomic of a "command" language as Bash since they're two different paradigms. They just happen to both output script artifacts.
- lisasays 4y agoAssuming you've already paid the not-insignificant upfront cost to learn Bash Which is precisely the sticking point with bash. The learning curve to do bash even adequately right, while perhaps not too steep - is definitely quite slippery. And (as you apparently point out also) once you've done the time (and misery), it unfortunately does not yield anywhere near to productivity benefits in other domains, compared to the the other languages mentioned.
- shrimp_emoji 4y ago> The learning curve to do bash even adequately right, while perhaps not too steep - is definitely quite slippery. Haha, yep. I think a good metric for the difficulty of a technology is how awful StackOverflow answers and code snippets are. Bash, C, and CMake are the worst in my experience, in that order. :p > it unfortunately does not yield anywhere near to productivity benefits in other domains, compared to the the other languages mentioned. I assert that this depends on what you're doing. If you're doing general programming (e.g., making an application for end users), a general purpose language will be better than a command language. If you're doing system programming (e.g., an automation or installation script), a command language will be better than a general purpose language. Bash is Unix's command language. If I rewrote my maintenance scripts in Python, they'd be these awkward wrappings around Linux commands that Python naturally treats as second-class citizens. My Bash scripts are much better to work with, and I feel more productive with it in systems work than Python. It's awkward and weird, but that's probably inherent to being a useful and compact command language.
- bradknowles 4y agoThe thing about scripting in bash is that it builds on top of all the other CLI things that you've done or tend to do. What you do on the CLI can easily be automated via scripting in bash. But if you never ever use the CLI, then scripting in bash is going to be more alien to you.
- lisasays 4y agoThat's the thing - with bash you start of thinking "this is easy, just like typing a bunch of shell commands after one another" ... But, ah, no.