News for hackers. Stuff that matters.
Re:Bash Pitfalls by renewiltord on Monday September 07, 2020 @05:11PM (#24402925)
What frameworks/libraries do you use? I find that the reason I prefer using a shell script is:

* ergonomic integration with the shell

* easy piping

* easy input/output redirection

Maybe Ruby comes close with the backticks or `system` but it still isn't as nice as a shell IMHO

Re:Bash Pitfalls by GuB-42 on Monday September 07, 2020 @05:30PM (#24403090)
For me, it would be Perl.

Perl is influenced by shell scripting and there are several easy ways to run commands, build pipes, redirect and other things shells are good at, like testing and listing files.

And as ugly as Perl looks, it has much less pitfalls than shell scripts.

Re:Bash Pitfalls by renewiltord on Monday September 07, 2020 @07:38PM (#24403834)
I wrote some Perl code once and it looks like you need more than a passing familiarity with the language to create code that is not just write-once.
Re:Bash Pitfalls by GuB-42 on Monday September 07, 2020 @08:18PM (#24404047)
With proper development practices, you can write clean Perl, even if you don't know much about the language. It has the same constructs as most other procedural languages and you can apply the same principles. Object orientation is a bit tricky though.

The thing is, Perl won't help you with discipline. If you want write-only code, Perl will compile it, no problem.

For that reason, it is the language of choice for one liners and throwaway scripts (and that's how I use it most or the times). But writing clean Perl is perfectly doable, though I usually prefer static languages if maintainable code is a priority (no Perl, no shell, not even Python).

Re:Bash Pitfalls by im3w1l on Monday September 07, 2020 @07:29PM (#24403798)
While bash itself has some warts, many of the issues are inherent to spawning child processes for accomplishing tasks. Thus, when possible, I try to use proper libraries rather than invoking commands from any language at all.
Re:Bash Pitfalls by renewiltord on Monday September 07, 2020 @07:38PM (#24403828)
I see. Which ones have you found most ergonomic to use?
Re:Bash Pitfalls by im3w1l on Monday September 07, 2020 @07:52PM (#24403913)
Python and as for libraries, well that's very dependent on what I want to accomplish, obviously.