Live data from Hacker News

Bashblog – a single bash script to create blogs

github.com

81–90 of 93 posts

Re: Bashblog – a single bash script to create blogs

#81

Earlier quoted context omitted.

> 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 langu…

> 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 i…

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

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

Re: Bashblog – a single bash script to create blogs

#82

Earlier quoted context omitted.

Known system dependency that's (almost) always on the system you're on. I remember somebody once telling me that they had learned vi because "it was always installed". Well, no, technically, the only editor you can be sure is there is ed. So, you know, learn that. I was surprised that they actually did. Bash is syntactically not perfect, I agree. However it's a well known, mature, stable environment. LLMs can write i…

Who's updating their blog from a random machine without Python on it, though?

It's not python that's the dependency that needs managing. It's pip and the keystone cops it brings along.

Re: Bashblog – a single bash script to create blogs

#83
post #66
post #19

Earlier quoted context omitted.

Go has a fast enough compile speed I feel like you could syntactically sugar it to be a command line.

Why would you compile it each time? You would compile the binary once and the use it. This is what Go equivalents of this already do (e.g. Hugo).

Because a shell is an ergonomic programming language. If you compile a binary then you're implementing another programming language interpreter.

AFAIK the Go jupyter kernel does something like this but it sequentially links previous compilation results to the current cell. Memory use is probably not great for a shell care though (since each linked Go library is a whole separate Go runtime).

Re: Bashblog – a single bash script to create blogs

#84

Earlier quoted context omitted.

> 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 i…

> However if it's all you got, eh, go for it. Mercifully, it isn't all we've got!

[deleted]

Re: Bashblog – a single bash script to create blogs

#85

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.

Re: Bashblog – a single bash script to create blogs

#86
post #56

It's so interesting to me how people consider writing bash scripts to be some sort of absurdist gimmick. I've made some scripts like this for blogging, as well as many other things. 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 ra…

Another big reason, for me at least, is that the scripts are unlikely to degrade over time.

A process or workflow that involves a 3rd party service or application will have to be modified or reconsidered as the 3rd party's functionality changes, is updated, or disappears.

Re: Bashblog – a single bash script to create blogs

#87

Earlier quoted context omitted.

Known system dependency that's (almost) always on the system you're on. I remember somebody once telling me that they had learned vi because "it was always installed". Well, no, technically, the only editor you can be sure is there is ed. So, you know, learn that. I was surprised that they actually did. Bash is syntactically not perfect, I agree. However it's a well known, mature, stable environment. LLMs can write i…

To be fair, qualifying bash as on (almost) every system and then poo-pooing vi as being also on (almost) every system seems odd. Had you said sh instead of bash the analogy would have worked better.

True, I'll take that. I haven't been on a machine without bash in ~25 years though, but I have been on machines without vi. But yeah, from a "what can I expect from a POSIX-like environment bare-bones minimum install" perspective, you're right.

Re: Bashblog – a single bash script to create blogs

#88

mine is: 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 {} +

The only issue is pandoc is a pretty heavy dep. A fantastic tool, but a very heavy one.

Re: Bashblog – a single bash script to create blogs

#89
post #73
post #64

Earlier quoted context omitted.

Wow that was pretty passive agressive lol, sure you're probably right

I’d argue that was active aggressive, actually.

Would be interested if OP had wrote, AI built me my own blog engine. Instead of saying "I built". If person wrote 90% of code and used AI for only 10% that's only for refactoring or commenting or optimizing then it won't be wrong to say "I built". But when 90% is written by AI and user just makes minor edits its not ethical. An on the contrary AI has itself been written by other humans and Its been trained over millions of code/work written by other humans. So essentially when AI writes some code, its those humans who were writing. If we can't credit all those humans, atleast make your statement rightfullt
Post reply on HN