Maybe even some library with stuff for parsing outputs of common commands?
Ask HN: What to use instead of Bash / Sh for scripting?
71–80 of 106 posts
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#72Re: Ask HN: What to use instead of Bash / Sh for scripting?
#73Can recommend!
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#74Perl (5). It's an incredibly capable scripting language, many things essential for Shell programming are much better integrated than in Python (e.g. regular expressions). It gets a lot of hate these days but it's still a damn fine language and perfectly suited to shell programming (and larger projects).
One of the things about Perl is that I can't quite believe myself how far it has fallen. I was never a Perl monk by any means but I knew enough to get by. And why did I not even think about it? I haven't coded Perl in years, but if my memory serves me correctly, bundling extra dependencies in Perl was a heck of a lot less painful than Python too.
Really sad it lost so much traction in the last decade, I partially blame it on the failed Perl6 endeavour. I also mostly use Python these days but looking at my old Perl scripts Python really doesn't come close in terms of succintness.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#75Can you be more specific than "fatigue"? That sounds like ennui, in which case maybe consider a job switch instead of a language switch (not being sarcastic or intentionally mean). Bash plus all the Unix tools (awk, grep, sed, tsort, comm, the ones I don't know, etc.) have pretty long legs, in terms of functionality and the syntax is pretty understandable. They provide most of what Perl offers, apart from OO (-ish) a…
> If you want strong typing (are you scripting in the large?), then, almost by definition, no scripting language provides that. Powershell is basically strongly typed. > Can you be more specific than "fatigue"? That sounds like ennui I love my job, but bash makes me wanna hang myself. I can say the same about stored procedures. Its like going back to cobol days. Some people have strong tastes I guess.
So doesn’t behave like a strongly typed language to me.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#76Is there a language with sane syntax (if, for, comparisons being a syntactic feature not commands requiring ; in weird places) that would still execute every line by default and support pipelines and && and || natively? Sort of bash that looks like a normal language. Maybe even some library with stuff for parsing outputs of common commands?
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#77However I agree that nim / zig could also be good directions
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#78Earlier quoted context omitted.
Which is why I'm writing most of my tooling in Rust . Deployment or installation is just one scp away. not rewriting, just when It needs large refactoring, or is currently a mess, or brand new.
Assuming you're deploying to the same OS/architecture that you're working from, otherwise you'd have to rebuild (which Rust makes easy to do, but still)
Though in all those cases, for me, all alternatives are just as bad or worse.
Getting ansible running on a windows server is... unfortunate. Ensuring that your bash script runs on OSX is easier, but I've had lots of unexpected issues with tools like grep or find working just a tiny bit different. And so on.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#79If your colleagues can be expected to have Docker, you can wrap your Python script in an image that contains specific versions of Python and the dependencies.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#80Earlier quoted context omitted.
Assuming you're deploying to the same OS/architecture that you're working from, otherwise you'd have to rebuild (which Rust makes easy to do, but still)
True. Though in all those cases, for me, all alternatives are just as bad or worse. Getting ansible running on a windows server is... unfortunate. Ensuring that your bash script runs on OSX is easier, but I've had lots of unexpected issues with tools like grep or find working just a tiny bit different. And so on.