To fellow mental patients using portable shell scripts for OSDev

Programming, for all ages and all languages.
Post Reply
User avatar
bowdrill
Posts: 5
Joined: Tue Jul 01, 2025 12:32 pm

To fellow mental patients using portable shell scripts for OSDev

Post by bowdrill »

I'm on the insane quest to perfect Arcane, a nice programming environment for portable shell code. It reproduces cross-referenced documents and binaries using unprivileged accounts.

From https://www.etalabs.net/sh_tricks.html
It is my hope that these tricks serve to show that is IS possible to write correct, robust programs using the plain POSIX shell, despite common pitfalls, but also that the lengths needed to do so are often extremely perverse and inefficient.
They're right. I suffered to expand macros, reproduce binaries, and write cross-referenced documents of any format (akin to an interpreted flat assembler g with its own typesetter). This result uses no more than the common behaviors of built-in utilities found in ash, bash, dash, ksh, ksh93, yash, and zsh. I exclude mksh because the bottleneck I can't optimize (looping over bytes in a variable) slows mksh to a crawl. Portable code is already slow enough.

I tested and "normalized" shells in the same way that a CSS+JS author normalizes supported browsers. I'm strict about the lean dependency profile: no compilers, no assemblers, no external "build system." Not even mkdir, cat, sed, or other "mandatory" utilities are required. Everything hinges on built-ins from the oldest POSIX XCU volume I can support, and that needs to be enough to generate a FAT32 volume containing a UEFI+IA-64 application and its manual. That application need not be an OS, hence me posting in this forum.

Why care this much?

So I and this community need fewer licenses to practice system dev concepts on a whim, without needing to install anything. Just grab the shell you happen to trust on the system you happen to have, along with any specs needed for a target environment. Then use Arcane to support a one-liner like

Code: Select all

% \sh mkimg | \dd bs=4K of="${of?}" # of=/dev/... 
If you care about reducing commercial invasion of residential life, then I think Arcane helps. The point is to switch to your software with fewer licenses. Arcane ships in a book, such that you can type the whole product in an air-gapped system to reproduce the results; The book documents and contains the cheating quine that produced it, for double-sided printing on about 250 leaves of A5 paper.

Where's the code?

In private storage. I spent WAY too much time to publish it in view of scrapers and LLMs, and my name is all over the work. Normally I'd lead with the code, but I ask you DM me to negotiate mutual authentication and exchange public keys. We'll sign a bill of materials and a license, then I'll distribute Arcane to you privately. Depending on the terms, the license might be free. For those able and willing to pay, I'll work towards adding support for your device to the extent that I can.
Post Reply