4 ms·
What language do you believe is better for DevOps / Linux systems engineering than Bash?
by solotronics 5y ago
What language do you believe is better for DevOps / Linux systems engineering than Bash?
- literallyaduck 5y agoPowershell with its inconsistent returns, weird pipeline behavior at random, and bad default output settings is not better but like all crappy pop songs pushed by the music industry it will gain popularity. NodeJS and Python could be contenders but Bash has them beat in longevity.
- solotronics 5y agoHow is python better? If I want to say install 5 different yum packages and then do a kubernetes command the bash is pretty straightforward. With python I would have to do subprocess.call and then handle the exit codes and errors in python.
- literallyaduck 5y agoBoth Node and Python attempt an OS abstraction layer which in theory could be an advantage in practice it is a leaky abstraction. Both have many packages which could enhance scripting and even the opportunity for private repos. Installing from yum makes me believe you are using Fedora so cross platform might not be a concern for you. If running on windows is a concern Cygwin could be an opportunity. I'd say Bash, Node, Python, then PowerShell in order of advantage.
- cranekam 5y agoOnce you need concurrency or have anything but the most basic logic almost anything trumps bash. It’s possible to implement basically anything in bash, of course, but that doesn’t make it sensible. Its error handling is poor, there are too many ways to do things (eg [ vs [[ vs test), dealing with non-scalar data is a pain, it has subtle gotchas (accidentally spawning a subshell and shadowing variables), it’s cryptic (${foo#bar} and friends are cool but much harder to remember than something like .replace()), and so on. If I’m just writing small tools that wire a few basic commands together bash is fine. For anything that actually needs data to be crunched or decent error handling Python, Go, Perl (though also cryptic), C++ are, IMO, a far better choice.
- atribecalledqst 5y agoThe cryptic nature of Bash syntax is why I generally try to do all my scripting in Python these days, if it exceeds a certain level of complexity. i.e. if I want to just group a bunch of shell commands together with no special logic, Bash is usually OK. For anything more complicated than an if statement or while loop I have to refer back to old scripts to remember the syntax. Not an ideal situation. I did recently have a case where I needed to run a shell command with a multi-line output, and an easy call to os.popen() wasn't returning the full output. So, back to Bash arrays and weird text parsing syntax (IFS=" " read tempArray...) I went...