| ▲ | IdiotSavage 9 hours ago | ||||||||||||||||||||||
In this thread: bash experts with arcane knowledge, unintentionally demonstrating how awful bash is. The obvious solution would be to use something more sane, like PowerShell or nushell, but instead old experts will always defend the skills they have honed for years, while criticizing anything that's different. | |||||||||||||||||||||||
| ▲ | Grimeton 25 minutes ago | parent | next [-] | ||||||||||||||||||||||
No, there are two problems here: 1. Things have developed over time. Bash and other shells weren't always this way. If you have ever touched different shells, awk, sed and so on and then touch perl you see how it is basically just the glue between the other tools put into one language. 2. The majority of scripts is written in sh or bash. So these shells won't go away anytime soon and any newcomer will be confronted with them. So it's best to know all the edge cases before you do stuff you don't want to do. And yes, you could always install another shell. But that brings another dependency and opens up another can of worms. In professional environments it's not really an option to have the next exotic language. It's like having a tmux.conf on your local machine that configures tmux exactly the way you want it. Nice to have but the moment you touch any of the other billions of systems out there that run the default configuration, you might be lost because you never learned the default and only use your modified version. | |||||||||||||||||||||||
| ▲ | dundarious an hour ago | parent | prev | next [-] | ||||||||||||||||||||||
Given the alternative proposed by OP was more of the same but with layers on top, saying "how about just using xargs and sh anyway" is a simplification -- learn 2 tiny things vs start depending on some new tool whose only purpose is to let you avoid learning those 2 tiny things by adding template language, etc., on top? I'll learn the 2. As for widening the scope to other tools, I've written about that on here before, how I have lots of powershell experience, some nushell, etc. I haven't become a convert (definitely not on Linux, of course occasionally on Windows). Happy to respond to any input or anything, but you should reply directly to people if you're going to criticize them -- very poor form to blanket criticize while also taking an uncharitable read. | |||||||||||||||||||||||
| ▲ | sgarland 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
As others have pointed out throughout the thread, the reason we defend the skills is that there’s a high likelihood that these tools will always be available on any machine; PowerShell and nushell, not so much. | |||||||||||||||||||||||
| ▲ | GuB-42 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Maybe it is out of habit, but I never managed to get into PowerShell, in fact, I am not at easy with the Microsoft way of doing things, with few exceptions. Too much UNIX I guess. Nushell seems to be based on the PowerShell philosophy of using structured data and not text, not my thing. I really like the UNIX way of using text I/O, it has it flaws but it works for me. But that being said, I still hate bash and all its family. It has so many footguns it is an entire armory at this point, mostly related to spaces and escaping. Something Perl-like could be a saner replacement. It is already a bit shell-like, it doesn't struggle with escaping the way bash does, and it has very powerful text processing abilities that go well with traditional UNIX tools. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | jltsiren 6 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
You could also say that English is an awful language, because the spelling and the pronunciation have diverged too far. But it's the international lingua franca in most contexts, because it's the international lingua franca in most contexts. People use Bash as the default shell for scripting, because people use Bash as the default shell for scripting. If you want to replace it, you should pick a winner and discourage the use of alternatives, especially when they are better than Bash. So don't say "use something more sane, like PowerShell or nushell". Say something like "use PowerShell, or Bash if you really have to for legacy purposes, but never use nushell for any reason" instead. | |||||||||||||||||||||||
| ▲ | nxobject 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
This is a sleeper option, but 'xonsh' as a Python superset is a very pleasant experience, especially when you just don't feel like learning another bespoke language for the complex stuff. I once had to scrape the output out of something hacked together by a grad student 10 years before me, scrape yet another hacked together application, do some fancy numerics, and then plonk it into a database. I did it without tears! | |||||||||||||||||||||||
| ▲ | jjgreen 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Bash is for whippersnappers, us old gits use POSIX sh | |||||||||||||||||||||||
| ▲ | ubercore 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
I'm sure it's essentially a familiarity thing, but PowerShell and nushell is way too much typing for me. | |||||||||||||||||||||||
| ▲ | lobofta 9 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Switched to Nushell and I am not looking back. I don't see any major reason why we should keep dragging Bash into the twenty first century. Nushell is the first time I feel like I can write complex systems operations in a shell without having to spend either a ton of time in the docs or being at the mercy of an LLM. It is godsend. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | ndsipa_pomu 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Yes, Bash is filled with footguns and is awful due to that. However, it's still incredibly useful as it's everywhere and has a far greater lifespan than almost anything else. You can write scripts in PowerShell or nushell, but then find that twenty years later they're no longer usable or you find a twenty year old machine that won't have PowerShell/nushell installed. It's not so much about defending arcane scripting skills, but that Bash functions as a lowest common denominator and is useful because of that. If you want something that works reliably over decades, then it's best not to go for an "improved" shell as it may not still be around. I like to think of Bash script writing as the opposite of riding a bike - you have to relearn it almost every time you write a script. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | kfsone 9 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
I was the kind of shell guru whose teeth itched when they saw someone doing `grep | awk`. Then I had to try and bring Windows into a Mac+Linux CI system under Jenkins groovy files that were full of `"""sh` fragments, shell scriptlets wrapping python, etc, etc, and I don't bat (I don't groovy either). Option 1: Learn to bat and try to translate. Hmm. No. Just no Option 2: ? Pwsh core had just come out. My immediate thought was that it would be great material for an anti-MS-ragging blog post, but then a line leapt out at me from one article I was glossing over: "... POSIX Terminal Shell Spec ...". I still wanted that anti-MS-ragging blog material, so I decided to try and use Pwsh as a Rosetta stone until I got to a point I could convert to a real language. But things just began to click for me. It was like going from Perl to Python - suddenly everything is an object and you can interact with everything* that way. There's no need for grep or awk or sed in pwsh, because the output of a shell command is an object -- a string (or []byte). It has methods. (netstat -an).replace("192.168.86.", "10.0.100.") 6 years later, pwsh is the default shell on my Mac, Ubuntu boxes, lab vms, ... everything but my docker containers unless I'm feeling feisty. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | amelius 8 hours ago | parent | prev [-] | ||||||||||||||||||||||
Yes, Bash has no place in modern software engineering. The only reasons people still use it are historical and laziness. If it was invented today, professionals would cringe at it. | |||||||||||||||||||||||