readonly(1) on Solnix vs Linux and the BSDs

On Solnix, readonly is a shell built-in, not a separate binary, and its page documents three variants (sh, ksh, ksh93). The FreeBSD counterpart is only the builtin(1) index page, which says readonly exists in sh(1) and not in csh(1); it does not describe readonly's behaviour or options.

What Solnix runs

readonly is built into sh, ksh and ksh93 on a default Solnix system, and no separate binary is shipped. The Solnix page documents each shell separately. The sh form takes only names. The ksh form adds name=value and -p. The ksh93 form adds name=value and -p, and treats readonly as a declaration command. csh is not covered by this page.

Differences

Compared withTopicWhat differs
FreeBSDwhat the counterpart page isThe FreeBSD readonly(1) page is the builtin(1) index of csh and sh built-ins. It has no readonly synopsis, options or exit status, so behaviour cannot be compared beyond existence. The Solnix page documents the command itself.
Source: FreeBSD builtin(1) NAME, DESCRIPTION; Solnix readonly(1) SYNOPSIS
FreeBSDavailability by shellFreeBSD lists readonly as a sh(1) built-in only. It is not in csh(1) and has no standalone utility. Solnix documents it for sh, ksh and ksh93, and its page does not list csh.
Source: FreeBSD builtin(1) Commands table (readonly: No / No / Yes); Solnix readonly(1) SYNOPSIS
FreeBSD-p optionSolnix ksh and ksh93 readonly accept -p, which prints readonly variables in a form suitable for re-input to the shell. The FreeBSD page documents no options for readonly, so the manual does not say whether FreeBSD sh supports -p.
Source: Solnix readonly(1) ksh and ksh93 DESCRIPTION (-p); FreeBSD builtin(1)
FreeBSDname=value formSolnix ksh and ksh93 readonly accept name=value and set the value before marking the variable readonly. Solnix sh documents only readonly [name]... with no assignment form. The FreeBSD page does not say what its sh accepts.
Source: Solnix readonly(1) sh and ksh SYNOPSIS, ksh93 DESCRIPTION; FreeBSD builtin(1)
FreeBSDno argumentsOn Solnix sh, readonly with no arguments prints a list of all readonly names. On ksh93 it writes the names and values of all readonly variables to standard output. The FreeBSD page does not describe this.
Source: Solnix readonly(1) sh DESCRIPTION; ksh93 DESCRIPTION; FreeBSD builtin(1)
FreeBSDdeclaration command and special built-in rulesOn Solnix ksh93, readonly is a declaration command: no field splitting or pathname expansion on arguments, and tilde expansion on value. Preceding assignments persist, and errors abort a script. The FreeBSD page does not say.
Source: Solnix readonly(1) ksh93 DESCRIPTION; FreeBSD builtin(1)
FreeBSDexit statusSolnix documents exit status only for ksh93: 0 for success, greater than 0 for an error. The FreeBSD page documents no exit status for readonly.
Source: Solnix readonly(1) EXIT STATUS (ksh93); FreeBSD builtin(1)

Standards

  • POSIX: readonly is not listed as a POSIX.1-2024 utility in the header for this page.
  • Solnix: The ksh -p output format is described in the page, but the page has no STANDARDS or ATTRIBUTES section and names no standard for it.

Writing portable scripts

  • In portable scripts, set the variable first, then run readonly name. The name=value form and -p are documented only for Solnix ksh and ksh93, and the FreeBSD page does not confirm them for sh.
  • Do not use readonly from csh scripts. The FreeBSD index lists it only for sh, and the Solnix page does not cover csh.

Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.