Comment on What are the recommended scripting languages for complex shell scripts beyond bash?

<- View Parent
Knusper@feddit.de ⁨1⁩ ⁨year⁩ ago

Oh, I didn’t mean to say, you should throw out your shell scripts. For anything less than, say, 20 lines, they’re perfectly appropriate.

I’m saying, Rust starts to feel like a good choice from, say, 100 lines upwards, and I just don’t think, it’s worth bridging the gap between those two.

In particular, you can build a function that allows you to run commands without much boilerplate, e.g.: run(“echo hello | tee out.txt”);
(The implementation just appends that argument to Command::new(“sh”).arg(“-c”) and runs it.)

That way, you can do the more complex things in Rust, whether that’s control flow or something like modifying a JSON file, without giving up the utility of all the CLI tools on your system…

source
Sort:hotnewtop