Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A single 1200 line bash script to create blogs.

I love bash for quick hacks. I abhor it for things like this.



Bash is HN's little punching bag language for some reason. Every post about shell programming or project thereof sees a hoard of comments denouncing the language in vage, unspecific terms, "if you need to write more than $N lines of sh, you should use a REAL language".

I'm truly mystified as to why we're doing this. True, shell programming has footguns, but they're not egregiously numerous compared to the typical suggestioned replacements.

Funnily enough, when the issues with these other languages are brought up—like arbitrary code execution on module import—instead of shallow comments, we often cue an informative and interesting discussion.

Why do we HNers treat the shell language so differently?

One of my working hypotheses is that it's due to shell being both ubiquitous and unfamiliar. Everyone uses it but earnest study is rare. That perhaps make it an easy stress sink for our various sublimated frustrations.

I'm an unabashed (heh) fan of shell programming. It really is a beautiful little language once you learn how to think in terms of data streams, dynamic scope, and DSL design.


Why? If it works and it gives you the features you require that where's the issue? If all 1200 lines of code are utilised and provides you with the blog stack then that's pretty efficient.

How is this any different of someone including multiple python modules to create the same stack for which probably amount to more lines of code if you were to copy and paste in to a single document.

It's like react, a stack with stupid amount of LoC only for the developer to use 1% of and the rest sits unused and bugs the site.

You can source bash scripts so if it's lines of code, break them in to chunks.


> If it works

It often doesn't work.

> How is this any different of someone including multiple python modules to create the same stack for which probably amount to more lines of code if you were to copy and paste in to a single document.

There's no problem with 1200 lines of code. The problem is 1200 lines of Bash. The difference is that Bash is incredibly awkward and error prone compared to almost every other language out there.


> It often doesn't work.

I suppose my main bash script on BSD, ~400 lines for backup, compilation and other admin tasks including a portable static text/plain web server have never failed me but never tested them interchangeably, so, prone some truth to failure.

I am not disagreeing of course and I would agree, Bash is designed for the system functions and that this is niche. However if it's all you got, eh, go for it.

Systems admin for 15 years and have handled some very hosed systems. Maybe the python binary got hosed and you were really desperate to share your lasagna recipe with your mother and the internet, it does have a purpose. Not ideal, sure.


> However if it's all you got, eh, go for it.

Mercifully, it isn't all we've got!


Note that I didn't say anything about "If it works and gives you the features you require", you added that.

If you remove that from your reply you're on your way to understanding why I don't like an absolute unit of a bash script.


I did yes, got ahead of myself there. I get it.

I'd rather a single unruly page of code to do the whole thing rather than multiple modules that do multiple things half-efficiently that require multiple thought to uncover.


For what it's worth, I bet this opinion literally doesn't matter anymore.

Write your thing in whatever you want, AI it into another language, done.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: