Live data from Hacker News

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

news.ycombinator.com

21–30 of 106 posts

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

#21

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.

Python is not a scripting language?

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

#22
post #21

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.

Python is not a scripting language?

Not designed for shell scripting.

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

#24

Earlier quoted context omitted.

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.

> It is a biiiiiiiiiiiiiiiiiiiig download 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 fi…

I just checked, if you already have .NET installed, the powershell package is about 20 MBs, which is… tolerable. However, I see that the latest version still starts very slowly compared to *nix shells (and also Python).

The shell was running from tmpfs (so basically a RAM disk). I have a decent processor and an NVMe SSD, and this is what I see (it was tested 10 times in a row to pull everything into the page cache properly, and the numbers are pretty stable):

  $ time ./pwsh /dev/null
  
  real 0m1.050s
  user 0m1.464s
  sys 0m0.067s
More than a second to execute an empty 'script', and even longer to get to the interactive prompt (which is harder to time properly so I'm not publishing any numbers).

It's even slower on an older Windows laptop which I have lying around (starts in about 3-4 seconds). Absolutely terrible for an interactive shell/script execution engine.

Just for comparison's sake, the same laptop can run an empty bash script in 2-3 milliseconds. This is very important when running build jobs, for example.

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

#25

Earlier quoted context omitted.

> It is a biiiiiiiiiiiiiiiiiiiig download 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 fi…

I just checked, if you already have .NET installed, the powershell package is about 20 MBs, which is… tolerable. However, I see that the latest version still starts very slowly compared to *nix shells (and also Python). The shell was running from tmpfs (so basically a RAM disk). I have a decent processor and an NVMe SSD, and this is what I see (it was tested 10 times in a row to pull everything into the page cache pr…

How about pwsh -NoLogo -NoProfile ?

    > Measure-Command { pwsh -NoProfile -NoLogo exit }
    
    Days              : 0
    Hours             : 0
    Minutes           : 0
    Seconds           : 0
    Milliseconds      : 254

BTW, Windows OS is often subject of Windows Defender and other AVs which are not present on Linux machines and their slowdown of the system is phenomenal.

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

#26
post #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 prog…

With typescript installed:

usr bin env ts-node

On phone but you get what I mean

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

#27

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

Also go has the advantage of producing a single static binary. Easy to build on your machine and run on another host.

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

#29

With nix you can make anything into a script, there's some people using haskell for example. I tend to use common lisp but I'm learning guile scheme and will probably move to that instead.

I don't understand (even though Nixos was my only OS for a couple of months).

How would Nix help me make Haskell into a script?

Post reply on HN