News for hackers. Stuff that matters.
Re:Ingest.sh – A portable shell script for codebase summariz... by alganet on Tuesday October 14, 2025 @10:27AM (#45580458)
> #!/bin/bash

I know that "portable" often means that it has no dependencies and it's self-contained, like in portableapps.com.

However, in shell scripting, the word "portable" is often used to describe a script that is not tied to a specific interpreter (it's not a bash script, or a zsh script, it just runs in any bourne shell).

I often recommend people to do both (can run on any shell and it is self-contained requiring no external dependencies), portable in any way.

---

You could, in theory, distribute this as a single file that runs on both bash and powershell, by making a polyglot, such as this one:

https://gist.github.com/alganet/2c1c004d0580e8d92cc1c167fa4f...

It would be called `ingest.cmd`. If you make the names of the functions the same across both, maybe you can even de-duplicate some parts of it into the part of the polyglot that addresses both interpreters (as long as that common part only deals in calling commands passing parameters).

---

> show_help() {

> echo "Usage: $0 [options] [source directory]"

> echo ""

May I introduce you to shell HEREDOCs? They're a great way to embed text, such as help snippets, directly into code without the need to resort to multiple echo calls.

https://linuxize.com/post/bash-heredoc/

Re:Ingest.sh – A portable shell script for codebase summariz... by hamzakat on Wednesday October 15, 2025 @06:14AM (#45590265)
polyglot sounds a nice idea. i'll consider do a unified script file later. thanks for sharing.