It's often not the best choice. There are situations where, I'd argue, it is. One of the main reasons, in my experience, is for very lightweight servers. I don't want python or node or anything. I want to run a web server with 128mb of ram and a 1gb disk. Somewhat niche, but it's useful to just use the base system.
The other useful thing about it is knowing your shell in general. Even if you're not on the infrastructure team, being comfortable knowing how to navigate a system is both fun and sometimes critical. You never know when you'll need it, and it's an interesting look into your tools.
It's akin to saying "why know how to use a saw when you can use a chainsaw" or "why know how to make a fire when you can use lighter fluid and a lighter?" Sometimes things come up. And it's fun to know how we got to where we are today.
find . -name '*.md' -type f -exec sh -c '
for file do
out="docs/${file#./}"
out="${out%.md}.html"
mkdir -p "$(dirname "$out")"
pandoc --quiet --template template.html "$file" -o "$out"
done
' sh {} +I love bash for quick hacks. I abhor it for things like this.
I used a similar system back in the day, nanoblogger:
PS: I don't know why HN allows downvoting seeing how it is always so abused. Nothing I wrote here is factually false, and what remains is just my personal opinion as a principled user of FOSS. A bit of tolerance for others' viewpoints is in order.
Engine: https://github.com/alganet/alganet.github.io/blob/master/bui...
Result: https://alganet.github.io/
Does RSS, updates old pages when index.html changes, dual-language.
My local test server is also shell: https://github.com/alganet/alganet.github.io/blob/master/ser... (good old https://gist.github.com/alganet/140c7c12d1603c244a01 from 2015)
There's absolutely 0 advantage, especially when AI can write simple code like that easily, over using any other language. It makes reading and maintaining much more complex.
Hell, even GitHub's syntax highlighting (and VS Code's) breaks in many places throughout the script. It's just a terrible developer experience, even for your own scripts that nobody else will ever touch.
Some people will say that the advantage is that you don't need to install another runtime, but even this is wrong as the script uses bash, not sh.
I hate Python with a passion, but I'd gladly take it over bash for any of those scripts.
like a microvm with normal language features. Something you can and want to actually attach a debugger onto it. Something independent of architecture too.
I just hate bash :| Even just using bash and curl and checking if its a website or an error page...
I have moved away to Jekyll again but there's always something alluring about single file things - single file webapps, single file LLMs (llamafile) and others
Because bash is maybe worst than C for this task.