4 ms·
Bashblog – a single bash script to create blogs
- hyperionultra 4mo agoMmm, good ol’ bash. I like it.
- IshKebab 4mo agoAwful old Bash. I hate it. Seriously I don't know why you'd do this in Bash. Crazy choice.
- xiaoyu2006 4mo ago...for fun!
- smetj 4mo agoWorks for me!
- Hendrikto 4mo agoSome people like to claim that using a pretty esoteric language with lots of weird footguns, lack of basic features and data types, and spawning subprocesses for everything, is somehow keeping it simple. I do not understand them.
- t-3 4mo agoWeird footguns don't matter if you stick to using shell for control flow, composition, and interpolation, and don't use all the weird things you have to look up every time. It's also very easy to do something in the commandline then just tail -n 8 $HISTFILE > script.sh and very little to no editing is needed to make that useful. Shell is not a programming language, it's an interface to the OS, and thinking about it like a programming language is just asking for frustration.
- jt2190 4mo ago> Shell is not a programming language, it's an interface to the OS, and thinking about it like a programming language is just asking for frustration. I guess this just isn’t obvious to me. Where do you see the boundary between “interface to the os” and “programming language”?
- t-3 4mo agoShell exists to give users a way to run programs. It was the user interface for UNIX, C was the programming interface. Yes, it's technically a programming language by any reasonable definition, but it's not meant to be used in the same way at all so that's not helpful.
- barrotes 4mo agoI honestly think that's the contrary: it's the laziest choice possible when you want something to work immediately without thinking too much about it. Till like 7 years ago I made literally every script to do "personal" stuff in bash, because I wasn't quite good with any programming language and bash... was just there in my Linux machine, and I was already familiar with it because I was a long time Linux user. Sometimes you end up committing it on github and people start issuing feature requests, and at the beginning you are just happy that your work fits the need of other people and you don't want to rewrite it from scratch with a better programming language and end up over-scripting it. That's basically the story of a little program I made years ago. Now I don't log in on github anymore because I'm afraid people is still requesting new features...
- PaulRobinson 4mo agoKnown 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 it well if you need them to. If it was perfect, we'd never have had Perl, and as a result we'd never have had Ruby, Python and other scripting languages. But I like it's a tool that doesn't require me to go reach for a package manager and some build tools I don't always have on every system.
- StilesCrisis 4mo agoWho's updating their blog from a random machine without Python on it, though?
- Jhsto 4mo agoI'd presume it's quite common with NixOS. At least I don't have python linked to my environment. It might be different would I use the REPL, but I do not, so for me python is a program (or script) dependency, not something I need to carry around. It's actually quite common for many setup scripts to fail when python is not installed, but not all of them list python as a dependency either.
- PaulRobinson 4mo agoIt's not python that's the dependency that needs managing. It's pip and the keystone cops it brings along.
- deleted 4mo ago[deleted]
- afandian 4mo agoI’ve been down this path (it was a script for scraping and extracting text). You write your text utility in bash. It works. Then you need a regex so you use sed. Then you wonder why it doesn’t work in your other environment. Then you find that GNU vs BSD sed have different syntax. Better to start with Python once you’re doing more than coordinating well known other tools.
- raphinou 4mo agoIt probably started as a helper script and grew from there. The script seems quite focused and doesn't grow, so a rewrite might not be warranted. It also has no other dependency, which is also good. I have written helper script to run coding agents in a container. And you guessed it, it's in bash. For the reasons I just wrote down. Should it have to grow I would rewrite it, but not currently.
- rpdillon 4mo agoReally? I think there's a nice niche for tools like nb that Just Work. Ubiquity is a feature! https://xwmx.github.io/nb/ https://xwmx.github.io/nb/
- hkt 4mo agoGlorious. I used a similar system back in the day, nanoblogger: https://nanoblogger.sourceforge.net/ https://nanoblogger.sourceforge.net/
- JSR_FDED 4mo agoAh, sourceforge!
- k3vinw 4mo agoAwesome! I’m the author and I created that project as a way to teach myself Bash at the time. I called it NanoBlogger because it was inspired by MicroBlogger, yet another Bash blog. I still have fond memories of the open source community’s warm welcome and amazing contributions to the project.
- hkt 3mo agoOh, that's amazing. Thank you so much. I still love the aesthetic of both using bash and the default template!
- kevinten10 4mo ago[flagged]
- bluebarbet 4mo agoThis is a good example of a program I would like to use if it was distributed in the standard repo of my OS, rather than totally unvetted on the Microsoft Github page of a random developer. 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.
- yolkedgeek 4mo agoWhat? That's how open source works
- Getchowned 4mo ago[dead]
- mikae1 4mo agoPackage management in the distro is also how FOSS works?
- dspillett 4mo agoThings that end up in curated package repositories like those of the various significant distros, have usually spent time growing on the random developer's own page (most common in the past) or said random developer's account on a forge like github (most common in more modern times). Standard repos might be were many discover things, but those things don't normally get there until they've build a following, so the random developers page is the more significant vector overall.
- bluebarbet 4mo agoFair enough. It would be nice if more developers would at least consider using the forges that don't belong to an ethically compromised big-tech oligopolist. The options are there.
- 4mo ago
- _ache_ 4mo agoI used to do that. Them move to a NodeJS script. Because bash is maybe worst than C for this task.
- chiply314 4mo agoIts time to invent something lightweight and good which runtime is so small that it becomes a system default. 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...
- nicbou 4mo agoI use Python for that, since I know it will always be on my machine. Is this what you have in mind?
- chiply314 4mo agoYeah but i have Python PTSD from all this Python 2 vs. 3 shit :D
- microtonal 4mo agoI'm sure that there are still Python 2 codebases there running an unsupported interpreter, but for most people that has been at least 5-10 years ago. Also, the Python project learned a lot from the messy transition, that I think it's unlikely to happen again.
- chiply314 4mo agoAnd then some old debian box comes out of shadow. I'm sure that ubuntu LTS also extended the life of this disaster + some tool you wanted to use which never upgraded. GNU Radio took ages
- tomwojcik 4mo agoThat was almost 20 years ago! We migrated 2 to 3 10 years ago. I'd say I moved on. I doubt there will ever be py4 :)
- edoceo 4mo agoPerl still loves you and will always be there.
- 4mitkumar 4mo agoOooh..reminds me of something similar I did earlier for own blog a few years back: https://github.com/proxygeek/publish/ https://github.com/proxygeek/publish/ 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
- iLoveOncall 4mo agoNice idea but I don't understand why people write bash scripts more than a few lines long. 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.
- jon-wood 4mo agoBash is the wrong choice for truly complex software but I still find it really hard to pick anything else for the sort of tasks where I'm mostly manipulating text files and shelling out to other tools. My general instinct for when its time to reimplement a script in Python or similar is when I've got a ton of conditionals or function calls, at that point its also time to start writing unit tests. shellcheck is a huge help in the middle sized shell script space and will regularly shout at me about missing all the random gotchas like not quoting file paths.
- k3vinw 4mo ago> Nice idea but I don't understand why people write bash scripts more than a few lines long. From a pragmatic perspective I agree. But I think you’re missing the point here. A lot of the most entertaining, and dare I say inspiring content, found on Hacker News is about exactly things like this. Things that seem silly, but are also very intentionally pushing the boundaries to the extreme/absurd.
- felooboolooomba 4mo agoA single 1200 line bash script to create blogs. I love bash for quick hacks. I abhor it for things like this.
- doublerabbit 4mo agoWhy? 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.
- felooboolooomba 4mo agoNote 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.
- doublerabbit 4mo agoI 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.
- IshKebab 4mo ago> 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.
- harrisi 4mo agoIt'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 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.
- graemep 4mo agoIts very niche. This is a static site generator so you could run something a lot heavier and then rsync the output to the server. Even lighter on the server than running bash there. It is also limited so you might have to add other things. The README suggests using markdown.pl for markdown support.
- jrm4 4mo agoBash gets way more hate than it deserves, in ways that are like "this kitchen knife is terrible for cutting down trees!" Like, yeah, why are you mad? And also, if a dude wants to cut down a tree with a kitchen knife that's actually pretty impressive.
- ludicrousdispla 4mo agoAnother 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.
- amaze_28 4mo agobash script for blogs is a clever idea but writing in terminal might not be. an alternative angle : script that reads local .md file and deploys it might work well.
- trebaud 4mo agoNot a bash script, but I built my own small blog generation engine to use with AI agents if anyone is interested https://github.com/trebaud/let-an-agent-build-your-blog https://github.com/trebaud/let-an-agent-build-your-blog
- pluc 4mo agoNobody's interested because everyone is one prompt away from exactly the same thing catered to their specific needs.
- trebaud 4mo agoWow that was pretty passive agressive lol, sure you're probably right
- asibahi 4mo agoI’d argue that was active aggressive, actually.
- G_o_D 4mo agoWould 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
- trebaud 4mo agoWho cares seriously? Its obvious in the repo that claude code is a contributor. I dont have time to play these ego games and prefix everything with "AI wrote 90% of this codebase" instead "I built". I just thought this would be useful to share. If you dont think this is useful then dont use it, it's that simple...
- malkosta 4mo agomine 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 {} +
- packetlost 4mo agoThe only issue is pandoc is a pretty heavy dep. A fantastic tool, but a very heavy one.
- malkosta 4mo agoyes true, but I already have it on all my machines, for diverse reasons...it wouldn't be hard to implement a markdown support, but it would be worse to maintain that
- gglitch 4mo agoSee also Shite: https://github.com/adityaathalye/shite https://github.com/adityaathalye/shite https://news.ycombinator.com/item?id=34486596 https://news.ycombinator.com/item?id=34486596
- mateenah 4mo agoI like it .. its an interesting take ...any plans of adding a on page editor ?
- gaigalas 4mo agoI've been using shell to blog for a while. Engine: https://github.com/alganet/alganet.github.io/blob/master/build.sh https://github.com/alganet/alganet.github.io/blob/master/bui... Result: https://alganet.github.io/ 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/serve.sh https://github.com/alganet/alganet.github.io/blob/master/ser... (good old https://gist.github.com/alganet/140c7c12d1603c244a01 https://gist.github.com/alganet/140c7c12d1603c244a01 from 2015)
- ndyg 4mo agoif you like bash web apps, you'll love https://github.com/cablehead/http-sh https://github.com/cablehead/http-sh