Remix.run Logo
pragma_x 2 days ago

IMO, using something like Python or JavaScript is a good idea if any of the following criteria is met:

- Working with data more than executing other binaries

- Dominant data processing path is structured (e.g. JSON, XML, binary)

- Script requires complex flow control to be manageable (e.g. functions, if, case)

- Shell UI requirements that involve handling command-line options

- You find yourself going _deep_ into the docs for jq to get the job done

.

Conversely, BASH is better under the following circumstances:

- Orchestrating other binaries the majority of the time

- Simple jobs that work with newline-separated text lines, or all data can be comfortably "stringly typed"

- Launching and job control for other processes

- You just need to glue some other shell commands and binaries together

- Are just manipulating shell environment vars, or providing a custom user shell (e.g. Python venv `activate`)

- Need to wrap a CLI tool in a simple way

.

The minute you have to reach for BASH arrays, case statements, math... stop everything and seriously consider using a language that has stronger support for all that.

wswope 2 days ago | parent [-]

Since you’re the only other person in this thread to mention it, I’m surprised the industry has been sleeping so hard on QuickJS as a scripting language runtime.

I think the lack of batteries-included stdlib is probably the biggest holdup, but JS can be much nicer than python for anything that can be decomposed into map/reduce/filter string munging.

pragma_x 2 days ago | parent [-]

I agree. For me, the major stumbling block is what interpreters ship with your typical Linux distro. Python and BASH are usually just... there. Everything else just takes more steps.