exit(1) on Solnix vs Linux and the BSDs
On Solnix, exit(1) documents the shell built-ins exit, return and goto for sh, csh, ksh and ksh93. There is no separate binary. The FreeBSD exit(1) page is only an index of built-ins and says nothing about exit semantics, so the behavioural detail below is Solnix-only.
The manual pages
- Solnix: exit(1) from
pkgs.solnix.illumos-world-man· illumos.org - FreeBSD: exit(1) 15.1-RELEASE
What Solnix runs
exit is a shell built-in (sh/ksh93/csh), not a separate binary on PATH. The page is published by pkgs.solnix.illumos-world-man, and no other variants are shipped. The page has separate sections for sh, csh, ksh and ksh93, and the behaviour depends on which shell runs the command. The bundle has a counterpart page only for FreeBSD, none for Linux, OpenBSD or NetBSD.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| FreeBSD | what the page is | Solnix exit(1) describes exit, return and goto in detail. FreeBSD exit(1) is the builtin(1) index of csh(1) and sh(1) built-ins. It only tells you which shell has a command and refers you to the shell manual. Source: Solnix exit(1) NAME, DESCRIPTION; FreeBSD exit(1) NAME, SYNOPSIS, DESCRIPTION |
| FreeBSD | which shells have which commands | FreeBSD lists exit in both csh and sh, return in sh only, and goto in csh only. Solnix documents return for sh, ksh and ksh93, and goto for csh. Its csh section has no return. Source: FreeBSD exit(1) Commands table (exit, return, goto rows); Solnix exit(1) SYNOPSIS |
| FreeBSD | ksh and ksh93 are covered | Solnix documents exit and return in ksh and ksh93 as well as sh and csh. The FreeBSD table has columns only for csh(1) and sh(1) and does not mention ksh. Source: Solnix exit(1) SYNOPSIS (ksh, ksh93); FreeBSD exit(1) DESCRIPTION and Commands table |
| FreeBSD | exit status range | Solnix ksh and ksh93 use the least significant 8 bits of n as the exit status of exit and return. The Solnix sh section does not state this. The FreeBSD page does not say. Source: Solnix exit(1) DESCRIPTION (ksh), EXIT STATUS (ksh93); FreeBSD exit(1) (not documented) |
| FreeBSD | exit inside a trap | In Solnix ksh and ksh93, when exit runs inside a trap and n is omitted, the status is that of the command that ran before the trap was invoked. In ksh93, an EXIT trap is run before the shell exits. The FreeBSD page does not describe either. Source: Solnix exit(1) DESCRIPTION (ksh, ksh93), EXIT STATUS (ksh93); FreeBSD exit(1) (not documented) |
| FreeBSD | return outside a function | In Solnix ksh and ksh93, return outside a function or dot script is the same as exit. The Solnix sh section and the FreeBSD page do not say what happens. Source: Solnix exit(1) DESCRIPTION (ksh, ksh93); FreeBSD exit(1) (not documented) |
| FreeBSD | csh exit takes an expression | Solnix csh exit takes an optional expression in parentheses: exit [( expr )]. Without it, the shell exits with the value of the status variable. The sh and ksh forms take a plain number n. Source: Solnix exit(1) SYNOPSIS and DESCRIPTION (csh); FreeBSD exit(1) (not documented) |
| FreeBSD | special built-in treatment | Solnix marks ksh and ksh93 exit and return as special built-ins. Assignments before them persist, and errors abort a script that contains them. The FreeBSD page does not say whether they are special. Source: Solnix exit(1) DESCRIPTION (ksh, ksh93 asterisk and plus notes); FreeBSD exit(1) (not documented) |
Standards
- POSIX: exit is not listed as a POSIX.1-2024 utility in the bundle header.
- Solnix: The ATTRIBUTES section in the bundle is empty (the table has no values), so no interface stability level is stated.
- FreeBSD: The FreeBSD page, as shown in the bundle, has no STANDARDS section.
Writing portable scripts
- Use exit with an explicit n between 0 and 255. Only the Solnix ksh and ksh93 sections say the value is reduced to the least significant 8 bits.
- Do not use return outside a function in portable scripts. The bundle documents it as equivalent to exit only for Solnix ksh and ksh93.
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.