Hacker News new | ask | show | jobs
by xelxebar 3170 days ago
At what point should one switch from an interpreted to a compiled language?

There probably aren't any hard and fast answers. Take Dracut [1], for example. It's a successful utility completely written as a collection of bash scripts. The answer probably depends on the specifics of your needs and specific benchmarks.

Bash gets a lot of hate, but if you take the time to really learn it as a language and use good coding practices---like linting, verbose warnings, and unit testing---then it's not too difficult to write long bash scripts well. I don't think it's really much trickier or dirtier than JavaScript.

One thing that helps is putting the spiritual equivalent of "use strict" at the top of your Bash script:

    shopt -s -o errexit pipefail nounset noclobber
Take a look at `help set` for info on what those settings do. Here's a list of resources that have helped me feel confident when writing bash:

    * Bash Hacker's Wiki [2]
    * ShellCheck [3]
    * Debugging Bash Scripts [4]
Also, this blog post gives some advice that I found useful:

    * Shell Scripts Matter [5]
[1] https://dracut.wiki.kernel.org/index.php/Main_Page

[2] http://wiki.bash-hackers.org/

[3] https://www.shellcheck.net/

[4] http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.htm...

[5] https://dev.to/thiht/shell-scripts-matter