I tend to use common lisp but I'm learning guile scheme and will probably move to that instead.
Ask HN: What to use instead of Bash / Sh for scripting?
11–20 of 106 posts
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#12I've been wondering the same myself... I want: - reliable scripts::in my case this means strong typing. Because for example currently to see the exit status of a program one need to check the exit number 0 or non zero plus the string for the command. - crosplatform:: this eliminates interpreted languages like ruby and python - easy to interact with the environment :: is something that like bash can actually call prog…
It still has other python-style problems, like epic dependency graphs, with all the compatibility and bitrot nightmares those imply.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#13Just use PowerShell. You can do so much in it without any dependency (jq is native in it and many other things). It is cross-platform so you can use your scripts anywhere. Don't use python or go or ruby or whatever as those are not scripting languages. IMO Bash is horror and should die already.
I use Powershell in Windows and am a big fan. It is a biiiiiiiiiiiiiiiiiiiig download on Linux, making it pretty impractical managing many different Linux machines.
How big really? Can't be more then 200MB? Should be less then minute to download and install? If you have docker, can you go that route?
Also, if you account the fact that you have variants of many other popular tools included OTB is that really a downside ?
That is certainly different concern, you want fast and practical script programming and why would you care if it has first time latency of couple of minutes if you are set good forever after that ?
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#14Perl is nice and ubiquitous.
Also, for scripting stuff, my (readable, extensible) perl is about 10% as long as other people’s python, so 500 lines of perl ends up being 5000 lines of python. That creates a huge difference in maintainability and correctness.
With code golf, my perl can be 10x shorter than that, but then it is neither readable nor extensible, and doesn’t scale to 500 (or even 50) lines before becoming more trouble than it’s worth.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#15Re: Ask HN: What to use instead of Bash / Sh for scripting?
#161) There aren't two disjoint versions to juggle
2) Dependency installation is clean and contained
3) Dependencies can easily be installed locally or globally, depending on your preference for isolation vs reuse
4) Lots of packages are available for doing cross-platform (read: Windows compatible) operations
5) JS makes it really easy to do efficient async tasks, for example high-IO scripting involving reading and writing lots of files and making network requests (without any dependencies, I might add)
At my last company I converted all our shell scripts to Node scripts when the pandemic hit, so they'd work predictably on Windows machines, and it was great. These days I'd do it that way to begin with.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#17I've been wondering the same myself... I want: - reliable scripts::in my case this means strong typing. Because for example currently to see the exit status of a program one need to check the exit number 0 or non zero plus the string for the command. - crosplatform:: this eliminates interpreted languages like ruby and python - easy to interact with the environment :: is something that like bash can actually call prog…
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#18I really like NodeJS for more complex system-scripting. In contrast with Python: 1) There aren't two disjoint versions to juggle 2) Dependency installation is clean and contained 3) Dependencies can easily be installed locally or globally, depending on your preference for isolation vs reuse 4) Lots of packages are available for doing cross-platform (read: Windows compatible) operations 5) JS makes it really easy to d…
I am familiar with and use quite a bit of js on the front end, but how is node for shelling out? This is something I find Python to be quite terrible at.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#19It's not the best fit for everyone but it has served me well.
Re: Ask HN: What to use instead of Bash / Sh for scripting?
#20I really like NodeJS for more complex system-scripting. In contrast with Python: 1) There aren't two disjoint versions to juggle 2) Dependency installation is clean and contained 3) Dependencies can easily be installed locally or globally, depending on your preference for isolation vs reuse 4) Lots of packages are available for doing cross-platform (read: Windows compatible) operations 5) JS makes it really easy to d…
JavaScript as a shell replacement, what a time to be alive! I am familiar with and use quite a bit of js on the front end, but how is node for shelling out? This is something I find Python to be quite terrible at.
Calling shell commands is reasonably straightforward:
const { exec} = require('child_process')
const child = exec('ls', ['-lh', '/usr'])
console.log('error', child.error)
console.log('stdout ', child.stdout)
console.log('stderr ', child.stderr)
However, you can also get cool packages like this to use instead: https://github.com/shelljs/shelljsI will admit though that in most of the cases where I've used it I didn't really do any shelling-out, so I can't speak much to how that experience scales in practice. Mostly I was either 1) doing self-contained logic with files, web requests, etc, or 2) delegating out to JS build tools (which even when they have a CLI, almost always expose a nice JS API too). Ymmv, etc.