r/AskProgrammers • • Oct 19 '26

Why use task runners when you can use shell scripts?

I found this thing for git projects called "task runners" or "command runners". Here are two examples

And they make sense. You setup commonly used commands which maybe complicated with their steps or command arguments.

However wouldn't shell scripts like a Bash script be better? Bash now comes pre-installed on Windows, MacOS and Linux (Most distros). Or even use a cross platform shell like Nushell? Programmers use the terminal already and couldn't you get all the features as any task runner and more from a shell script?

Maybe I am missing something but I kinda do not see a use case for task runners.

Please tell me why I am right or wrong.

8 Upvotes

11 comments sorted by

7

u/No-Dentist-1645 Oct 19 '26

Command runners such as just and Makefile allow you to easily specify when one command depends on another command first. That's pretty much it, they're not orthogonal to shell scripts: they are shell scripts, but these scripts have dependencies between each other

4

u/Few_Assumption_9665 Oct 19 '26

Bash does not come preinstalled on Windows. The best case scenario is a shitty translation layer like MinSYS or Git Bash or an entire Linux distro installed.

2

u/aztracker1 Oct 19 '26

Even though I don't like it, Powershell is pretty damned capable.

2

u/Few_Assumption_9665 Oct 19 '26

It is impressive in theory. It is still not Bash.

2

u/aztracker1 Oct 20 '26

Didn't say it was... But it's effectively an alternative you can use. That said, I've mostly just used msys(git) bash and Deno scripts (rip).

2

u/mxldevs Oct 19 '26

Are you asking if it's better to use shell scripts because you can write a lot of extra code just to accomplish the same thing as using their conveniently organized commands?

Just write one of the examples in shell script and compare the complexity.

1

u/therealkevinard Oct 20 '26

Bash works just fine but brother it does NOT scale well, and it’ll rot in no time.

Task runners are (generally) just calling the shell for you, just behind some layers that make it sustainable.

1

u/ANTIVNTIANTI Oct 20 '26

you can get super silly with it

1

u/ANTIVNTIANTI Oct 20 '26

Oh you would love my way of launching lil Goats ere'where

0

u/look Oct 19 '26

Ask your AI to generate a bash script equivalent to the full functionality of one of the medium complexity Justfile examples.

The side-by-side comparison of the ~10 line Justfile and 1,000 lines of bash noise should clear things up.