How to Use FreeCOM Batch Features Beyond a Linear Startup Script
Build reusable FreeCOM batch routines with arguments, labels, error handling, controlled environments, safe temporary files, and predictable quoting.
tag
11 posts
Build reusable FreeCOM batch routines with arguments, labels, error handling, controlled environments, safe temporary files, and predictable quoting.
How Haiku applications publish discoverable scripting suites, resolve property specifiers, validate BMessages, and return stable replies.
Errors like bad interpreter and $' ': command not found mean carriage returns reached a Unix shell script — confirm bytes, convert, enforce Git policy.
A maintainable shell library needs a documented target shell, namespaced functions, no import-time surprises, and tests run in fresh processes.
Choose the target shell, quote data, model arrays and pipelines correctly, and use focused ShellCheck directives only when genuinely needed.
Reliable shell cleanup requires understanding signals, traps, process groups, and the important difference between a normal exit and an uncatchable termination.
Writing shell scripts that run correctly under any POSIX-compliant shell, not just whichever one happens to be installed on your own machine.
An unquoted variable works in testing, then silently breaks the first time its value contains a space — the single most common shell scripting bug.
First previewed as Monad in 2003, renamed Windows PowerShell in April 2006, and released that November — replacing cmd.exe scripting with an object-oriented shell.
A command mid-pipeline dies with 'Broken pipe,' often only when piped into head — a specific, well-defined signal, not a random failure.
A FreeCOM-specific guide to portable DOS batch files using arguments, SHIFT, IF, ERRORLEVEL, FOR, GOTO, CALL, redirection, and defensive expansion.