Hacker News new | ask | show | jobs
by Spivak 1891 days ago
Huh? But bash is super powerful? I can go from zero to a script that's production ready in like an hour with option support, help text, man pages, shell completion, signal handling that's portable to any system.

I also like Python for this but it's an absolute PITA to distribute scripts that support lots of different versions of python or need any dependencies not in your distro's repos.

1 comments

Yes it's powerful, I agree about that. At the same time, it's not type safe (but Deno + Typescript would be), and the syntax is a bit funny, like the differences between `( (( [ [[` which I annoyingly often forget. One day, when I saw code like this:

    if [[ ${1:0:1} = '-' ]]; then
      ...
      set --
I got a bit annoyed, and said to myself that Bash scripts almost should be forbidden. I didn't know that syntax `${1:0:1}` and there wasn't really anything to websearch for — just different symbols.

Websearching for "bash bracket colon colon" something actually worked but it took a while. In a typed language, I'd just clicked a function and would have seen the docs, in an instant.

> from zero to a script that's production ready in like an hour with option support, help text, man pages, shell completion, signal handling that's portable to any system.

It seems you've been used Bash for quite a while. Then I'm guessing in your case, it's a good choice. Agreed that dependencies for Python or Deno or whatever else is annoying to have to include (the Deno runtime is sth like 50 - 60 MB if I remember correctly)