Abendless Software · Technical Note

Designing zash: A Fast POSIX Shell for z/OS UNIX

Bundled NetBSD libedit, ASCII/EBCDIC builds, and native spawn() semantics

· 2 min read

z/OSzashCshells

If you spend hours in SSH sessions on z/OS UNIX, you feel two things immediately: shell startup and pipeline overhead are higher than on Linux, and interactive line editing varies wildly depending on which shell happened to be installed on that LPAR.

zash is an Almquist-family POSIX shell written in portable C11 to address both problems without dragging in a heavy runtime.

Why an Almquist-family core?

Almquist-family shells (such as dash and FreeBSD sh) keep the parser, expander, and evaluator compact and fast. In-shell loops, arithmetic expansion, and read pipelines stay tight in memory and avoid unnecessary allocations. On z/OS—where process creation carries more overhead than on Linux—doing less work per command and using z/OS spawn() cleanly where possible makes a noticeable difference in everyday scripting.

Interactive comfort without external dependencies

For interactive sessions, zash bundles a statically linked port of NetBSD libedit (libedit/), along with bash-compatible prompt escapes and history. The only external link dependency is the system’s termcap/curses library (-lcurses on z/OS, ncurses on Linux).

Supporting both ASCII and EBCDIC shops

Not every z/OS installation uses the same encoding conventions. Following the zopen ecosystem, zash defaults to ASCII mode on z/OS, but retains clean EBCDIC build targets for shops that prefer native IBM-1047:

Command Toolchain Encoding
make zos IBM Open XL C/C++ (ibm-clang -m64) ASCII (default)
make zos OXL_ASCII= IBM Open XL C/C++ (ibm-clang -m64) EBCDIC
make xlc IBM z/OS XL C (xlc -q64) ASCII (default)
make xlc XLC_ASCII= IBM z/OS XL C (xlc -q64) EBCDIC
make clang or gcc on Linux / BSD Native POSIX

Switching targets automatically cleans stale object files so you can test across compilers without manual make clean steps.

For details on why source files must be tagged properly after a Git checkout on z/OS UNIX, see our support article on ASCII vs. EBCDIC file tagging.

Following development

You can browse the zash overview at zash.abendless.com or clone the source from GitHub or git.abendless.com. Questions and feedback are always welcome in the comments below.

Comments

Loading comments…

Leave a comment

Comments are moderated before appearing. Your email is never published.

← All posts