Live data from Hacker News

Ask HN: What to use instead of Bash / Sh for scripting?

news.ycombinator.com

1–10 of 106 posts

Ask HN: What to use instead of Bash / Sh for scripting?

#1
I'm at the point where I feel a certain fatigue writing Bash scripts, but I am just not sure of what the alternative is for medium sized (say, ~150-500 LOC) scripts.

The common refrain of "use Python" hasn't really worked fantastically: I don't know what version of Python I'm going to have on the system, installing dependencies is not fun, shelling out when needed is not pleasant, and the size of program always seemingly doubles.

I'm willing to accept something that's not on the system as long as it's one smallish binary that's available in multiple architectures. Right now, I've settled on (ab)using jq, using it whenever tasks get too complex, but I'm wondering if anyone else has found a better way that should also hopefully not be completely a black box to my colleagues?

Re: Ask HN: What to use instead of Bash / Sh for scripting?

#2
I’ve seen people use Go because it’s a simpler language. It’s what I would probably use if I didn’t want to use bash.

What do you think about editing the title to include “for scripting”? I thought you were asking for recommendations like zsh or fish when I first clicked

Re: Ask HN: What to use instead of Bash / Sh for scripting?

#3

I’ve seen people use Go because it’s a simpler language. It’s what I would probably use if I didn’t want to use bash. What do you think about editing the title to include “for scripting”? I thought you were asking for recommendations like zsh or fish when I first clicked

Good point, changed.

Re: Ask HN: What to use instead of Bash / Sh for scripting?

#6

Have you tried other shells like csh or tcsh?

The oldie Tom Christiansen anti (t)csh post is worth a read for those considering alternatives.

https://shlomif.github.io/open-source/anti/csh/ has a link to it, and other things.

Re: Ask HN: What to use instead of Bash / Sh for scripting?

#7
Just 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.

Re: Ask HN: What to use instead of Bash / Sh for scripting?

#9
I'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 programs installed on the computer.

As the song says: "But I still... haven't found... what I'm looking for."

Re: Ask HN: What to use instead of Bash / Sh for scripting?

#10

Just 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.
Post reply on HN