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.
Because bash is maybe worst than C for this task.
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...
Seriously I don't know why you'd do this in Bash. Crazy choice.
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.
I do not understand them.
Is this what you have in mind?
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.
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.
Many people have made micro Tcl’s too if you want something even lighter.
It has a built in subst command no need for a template engine!
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 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
I love bash for quick hacks. I abhor it for things like this.
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.
It is also limited so you might have to add other things. The README suggests using markdown.pl for markdown support.
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.
Write your thing in whatever you want, AI it into another language, done.
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.
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.
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.
A single Bash script to create blogs.
I created it because I wanted a very, very simple way to post entries to a blog by using a public folder on my server, without any special requirements and dependencies. Works on GNU/Linux, OSX and BSD.
How simple? Just type ./bb.sh post and start writing your blogpost.
You can see a sample here: read the initial blog post. That page was 100% generated using bashblog, no additional tweaking.
Check out other bashblog users
Download the code and copy bb.sh into a public folder (for example, $HOME/public_html/blog) and run
./bb.sh
This will show the available commands. If the file is not executable, type chmod +x bb.sh and retry.
Before creating your first post, you may want to configure the blog settings (title, author, etc). Read the Configuration section below for more information
To create your first post, just run:
./bb.sh post
It will try to use Markdown, if installed. To force HTML:
./bb.sh post -html
The script will handle the rest.
When you're done, access the public URL for that folder (e.g. http://server.com/~username/blog)
and you should see the index file and a new page for that post!
Please read the wiki to learn how to use the advanced features of Bashblog, such as headers and footers, static pages, and more.
bb.sh and start blogging.date, basename, grep, sed, head, etc)coreutils on a Mac.
It does some magic to autodetect which command switches it needs to run depending on your system.ftpfs and run this script locallyConfiguration is not required for a test drive, but if you plan on running your blog with bashblog, you will want to change the default titles, author names, etc, to match your own.
There are two ways to configure the blog strings:
bb.sh and modify the variables in the global_variables() function.config file with your configuration values -- useful if you don't want to touch the script and be able to update it regularly with gitThe software will load the values in the script first, then overwrite them with the values in the .config file.
This means that you don't need to define all variables in the config file, only those which you need to override
from the defaults.
The format of the .config file is just one variablename="value" per line, just like in the global_variables()
function. Please remember: quote the values, do not declare a variable with the dollar sign, do not use
spaces around the equal sign.
bashblog uses the $EDITOR environment value to open the text editor.
.backup.tar.gz)Read the Changelog section for more updates or check out the news on my blog
Bashblog started at 500 SLOC and it now has hit the 1000 SLOC barrier. If we want to keep the code minimal and understandable, we need to make the difficult effort to restrain ourselves from adding too many features.
All bugfixes are welcome, but brand new features need to be strongly justified to get into the main tree. Every new request will be honestly and civilly discussed on the comments. As a guideline, pull requests should:
create_html_file() or write_entry(), etc)date or grep)global_twitter_card_imagebody_begin_file_index.config for each onetemplate_tags_posts_singularThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
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.
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.
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.
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.