2 ms·
No, the point is that if you go into a discussion saying: "X is better than Y but I should warn you that I never bothered learning Y but instead spent my time l
by Arch-TK 4y ago
No, the point is that if you go into a discussion saying: "X is better than Y but I should warn you that I never bothered learning Y but instead spent my time learning X" your ability to provide an accurate comparison is already put into question.
Then you go on and provide examples of extremely sub-optimal Y code and compare it to X code you wrote.
It's very uncharitable and very difficult to tell what is actually better. It doesn't matter if X or Y is better at this point because you haven't provided a fair comparison. And while I agree that bash is shit, I need a lot more than "here's some poorly written bash code compared to nushell" to persuade me to switch to something less ubiquitous.
Since bash and presumably nushell are both turing complete, there should be an infinite number of ways of achieving any task, what you want to compare is the shortest but so short that they're difficult to comprehend solutions, and there aren't that many. I can't tell if you picked the most idiomatic nushell solutions to your problems but I can definitely tell you didn't do the same for bash.
If you're happy to use nushell you would probably be happy to enable globstar in your shell. So my first solution would be comparable to your nushell version. And yes, you need to know what globstar is, just like you would need to know what nushell is.
Given that bash and presumably nushell both support running arbitrary commands the find version is actually shell independent and the fact that you don't know how to use find isn't bash's problem.
Let's put it this way, given I don't know nushell, I would also have to learn the iterator, lambda, and variable substitution syntax (each, ||, $v.name). I know how equivalents of those features work in bash (for, $...). I don't find your code any easier to read by default (without having to make guesses as to how nushell works). If I claimed right now that I find nushell syntax to be confusing, weird and unusual, would you think it would be fair for me to say that based on reading only your code?
- 0dayz 4y agoYou miss the part about them saying that the code is from stackoverflow so in other words not exactly hacked together. Overall I agree with both of you but on different points, she'll scripting is an outdated painful process and yes we should provide optimal answers to be fair.
- Arch-TK 4y agoI don't think the code presented was taken directly from stackoverflow, and I don't think that's what the person I replied to said. That being said, even if it was from stackoverflow, stackoverflow is a poor resource for older languages/environments. There's still a major focus on points over quality answers and you get lots of bad advice from there.