trap(1) on Solnix vs Linux and the BSDs

On Solnix, trap is a shell built-in, not a separate binary, and the Solnix page documents it separately for sh, csh (as onintr), ksh and ksh93. The FreeBSD trap(1) page is only an index of shell built-ins and does not describe trap's behaviour, so a flag-by-flag comparison is not possible.

What Solnix runs

A default Solnix system has no trap binary. The behaviour depends on which shell runs it: sh, ksh and ksh93 each have their own trap section, and csh uses onintr instead. Only the ksh93 trap documents an option (-p). No other variants are shipped.

Differences

Compared withTopicWhat differs
FreeBSDwhat the manual page coversSolnix trap(1) describes how trap works in each shell. FreeBSD trap(1) is the builtin(1) index of shell built-ins and describes no trap semantics, so the bundle gives no FreeBSD trap behaviour to compare.
Source: Solnix trap(1) DESCRIPTION; FreeBSD trap(1) NAME and DESCRIPTION
FreeBSDwhich shells provide trapThe FreeBSD table lists trap as a built-in of sh(1) only, not csh(1), and not as a standalone utility. On Solnix, trap is in sh, ksh and ksh93, and csh uses onintr. FreeBSD lists onintr for csh(1) only.
Source: FreeBSD trap(1) Commands table (trap, onintr rows); Solnix trap(1) SYNOPSIS
FreeBSD-p optionSolnix ksh93 trap -p prints current traps in a form that can be fed back to the shell. The FreeBSD page documents no trap options, so the manual does not say whether FreeBSD sh has -p.
Source: Solnix trap(1) ksh93 -p; FreeBSD trap(1) (no trap options documented)
FreeBSDconditions beyond signalsSolnix ksh and ksh93 trap accept ERR and DEBUG. ksh93 also accepts KEYBD, and EXIT or 0 for exit. Solnix sh documents only signal numbers or names, with 0 for exit. The FreeBSD page lists no conditions, so the manual does not say what FreeBSD sh accepts.
Source: Solnix trap(1) ksh, ksh93 and sh DESCRIPTION; FreeBSD trap(1)
FreeBSDunknown condition and exit statusIn Solnix ksh93, an unknown condition makes trap exit non-zero but does not terminate the invoking shell. ksh93 trap exits 0 on success and >0 on error. The FreeBSD page states no exit status for trap.
Source: Solnix trap(1) ksh93 DESCRIPTION and exit values; FreeBSD trap(1)
FreeBSDignored-on-entry signalsOn Solnix, setting a trap on a signal that was ignored on entry to the shell has no effect. In ksh93 this reports no error. The FreeBSD page does not say how its sh behaves.
Source: Solnix trap(1) sh, ksh, ksh93 DESCRIPTION; FreeBSD trap(1)
Linux, OpenBSD, NetBSDno counterpart textThe bundle has no Linux, OpenBSD or NetBSD trap page. The manual here says nothing about how trap behaves on those systems.
Source: Bundle header (only a freebsd counterpart listed)

Standards

  • POSIX: trap is not listed as a POSIX.1-2024 utility in the bundle header.
  • Solnix: The ksh93 section says signal numbers other than 1, 2, 3, 6, 9, 14 and 15 are not portable.

Writing portable scripts

  • In scripts, trap only signals by name or by the numbers 1, 2, 3, 6, 9, 14 and 15, as the Solnix ksh93 text advises.
  • Do not rely on ERR, DEBUG or KEYBD conditions, or on trap -p, in portable scripts. The Solnix page documents them for ksh and ksh93, not for sh.

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.