summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-27 21:48:49 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-27 21:48:49 -0600
commit25e4830211e9810f1e2252219b8bd48ca59f401c (patch)
tree41f8e5f887f1b51998cd636c1cb87e34daa01f8b
parentced8928b067a3bd3047f7e094eb9d9d575ae9444 (diff)
downloadzash-25e4830211e9810f1e2252219b8bd48ca59f401c.tar.gz
docs: zash is the successor to IBM's ksh88 /bin/sh
The shell it replaces is not a different language: it is of the KornShell line, and a script written for it runs under zash. Say that where the documents used to imply the opposite -- "the dash of z/OS", "the z/OS /bin/sh's semantics are not emulated" -- and sort what is left into places where IBM departs from POSIX (zash follows POSIX) and the few ksh88 features zash declines.
-rw-r--r--DESIGN.md38
-rw-r--r--README.md18
-rw-r--r--web/content/_index.md5
3 files changed, 44 insertions, 17 deletions
diff --git a/DESIGN.md b/DESIGN.md
index a276e09..3af1300 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -838,6 +838,16 @@ Rules:
## Deliberate differences from other shells
+zash is the successor to the shell it replaces as well as a POSIX `sh`.
+IBM's `/bin/sh` is of the KornShell (ksh88) line, and the constructs its
+scripts use are all accepted here -- `print`, `whence`, `typeset`,
+`function f { }`, `[[ ]]`, `(( ))`, `let`, aliases, `trap ... ERR`,
+`read -t`, `select` -- so a script written for the IBM shell runs under
+zash. What is left below falls into two kinds: places where the IBM shell
+departs from POSIX, where zash follows POSIX, and the few ksh88 features
+zash declines ([Deferred or declined](#deferred-or-declined)). A script
+can only notice either kind if it was testing the quirk.
+
- The last stage of a pipeline runs in the current shell when it is
not an external command, as in ksh and the z/OS `/bin/sh` (unlike dash
and bash). `cmd | while read x; do ...; done` therefore needs no
@@ -865,12 +875,14 @@ Rules:
not).
- Exit statuses follow the ash family: 2 for a failed redirection,
127 from `type` and `command -v` for an unknown name.
-- The z/OS `/bin/sh`'s semantics are not emulated where it departs from
- POSIX and every other shell: `[ a \< b ]`, `fc`, arithmetic across a
- newline, an unterminated here-document, unquoted `$@` keeping empty
- fields, and `command eval` still exiting on an error. `bench/README.md`
- classifies every difference the two shells show on the `tests/posix`
- corpus, and none of them is a zash bug.
+- Where the z/OS `/bin/sh` and POSIX disagree, zash follows POSIX, so a
+ ksh88 script written against the IBM shell can tell in these places:
+ `[ a \< b ]` (POSIX requires it, IBM's shell rejects it), `fc` (a POSIX
+ special builtin, absent there), arithmetic across a newline, an
+ unterminated here-document, unquoted `$@` keeping empty fields, and
+ `command eval` ending the script on an error (POSIX says it must not).
+ `bench/README.md` classifies every difference the two shells show on
+ the `tests/posix` corpus, and none of them is a zash bug.
- The rule behind those two bullets: where zash and the z/OS `/bin/sh`
disagree, zash keeps the better behaviour as long as a script written
for IBM's ksh88 cannot tell the difference. The one case where it can
@@ -890,9 +902,10 @@ Rules:
Features beyond POSIX `sh`, taken from FreeBSD `sh` and the Korn shell.
The z/OS `/bin/sh` is described by IBM as based on the KornShell and
-conforming to POSIX 1003.2-1992. Scripts written for it use `print`,
-`whence`, `typeset`, `alias` and `function name { }`. The Korn items are
-here to keep those scripts running.
+conforming to POSIX 1003.2-1992, and scripts written for it use `print`,
+`whence`, `typeset`, `alias`, `function name { }` and `select`. zash is
+the successor to that shell, not a different language, so the Korn items
+are here to keep those scripts running unchanged.
### The performance rule
@@ -946,10 +959,13 @@ nothing measurable. Concretely:
and `expand.c` on the hot path. Only if real scripts need them, and
measured first.
- Extended globbing (`@(a|b)`, `*(x)`), co-processes (`|&`,
- `print -p`), `typeset -u/-l/-L/-R`, `select`.
+ `print -p`), `typeset -u/-l/-L/-R`.
- ksh93 and bash extras: associative arrays, `${v/pat/repl}`,
`${v:off:len}`, floating point, process substitution.
-- `MAIL` checking, `bind`, and FreeBSD's `-p` privileged mode.
+- `MAIL` checking, `bind`, and FreeBSD's `-p` privileged mode. IBM's
+ `/bin/sh` also takes the `-k`, `-K`, `-L` and `-t` letters, which zash
+ does not: no script in the corpus uses them, and `-p` would have to
+ ignore `ENV`, `PATH` and the exported environment to mean anything.
## The interactive layer
diff --git a/README.md b/README.md
index 90fccff..6455e21 100644
--- a/README.md
+++ b/README.md
@@ -45,13 +45,23 @@ zash is for shops that care about that:
- People who type at it. File and command completion, history and line
editing are in scope, provided they cost a script nothing.
-It aims to be the dash of z/OS, but more usable interactively.
+It aims to be the dash of z/OS, but more usable interactively, and the
+successor to the shell it replaces: IBM's `/bin/sh` is of the KornShell
+line, and the ksh88 constructs z/OS scripts use -- `print`, `whence`,
+`typeset`, `function f { }`, `[[ ]]`, `(( ))`, `let`, aliases, `trap ...
+ERR`, `read -t` -- are all here, so a script written for the IBM shell
+runs under zash unchanged. Where the two do differ, it is because the IBM
+shell departs from POSIX, or because the feature is one zash declines;
+[Deliberate differences](DESIGN.md#deliberate-differences-from-other-shells)
+says which, and `bench/README.md` records every difference the two shells
+show on the POSIX test corpus.
## Goals
-1. A drop-in replacement for the z/OS `/bin/sh` for POSIX scripts,
- including the z/OS behaviours scripts rely on (`_BPX_SHAREAS`,
- `_BPX_SPAWN_SCRIPT`, `STEPLIB`, file tagging).
+1. A drop-in replacement for the z/OS `/bin/sh` for POSIX scripts and
+ for the ksh88 constructs those scripts use, including the z/OS
+ behaviours scripts rely on (`_BPX_SHAREAS`, `_BPX_SPAWN_SCRIPT`,
+ `STEPLIB`, file tagging).
2. Script performance at least equal to `/bin/sh`, measured on z/OS,
by using `spawn()` instead of `fork()` and by not creating a process at
all for builtins, even in pipelines and command substitutions.
diff --git a/web/content/_index.md b/web/content/_index.md
index eb7077f..107a548 100644
--- a/web/content/_index.md
+++ b/web/content/_index.md
@@ -22,8 +22,9 @@ billed, and every `fork()` copies an address space.
<span class="n">02</span>
<h3>sh scripts, not a dialect</h3>
<p>Scripts written for zash run under the existing <code>/bin/sh</code>,
- dash, FreeBSD sh and bash. The Korn features z/OS scripts use are there
- where they cost other scripts nothing.</p>
+ dash, FreeBSD sh and bash. zash is the successor to IBM's KornShell-line
+ <code>/bin/sh</code>, not a new language: the Korn features those scripts
+ use are there, where they cost other scripts nothing.</p>
</li>
<li>
<span class="n">03</span>