shift(1) on Solnix vs Linux and the BSDs
On Solnix, shift is a shell built-in documented for sh, csh, ksh and ksh93, not a separate binary. The FreeBSD shift(1) page is only an index of built-ins and says nothing about how shift behaves, so no behavioural comparison with FreeBSD can be drawn from the bundle.
The manual pages
- Solnix: shift(1) from
pkgs.solnix.illumos-world-man· illumos.org - FreeBSD: shift(1) 15.1-RELEASE
What Solnix runs
A default Solnix system has no standalone shift command. It is a built-in of sh, ksh, ksh93 and csh, and the page describes each shell's version separately. No other variants are shipped. The Linux, OpenBSD and NetBSD pages are not in the bundle.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| FreeBSD | what the counterpart page is | FreeBSD shift(1) is the builtin(1) index page (NAME: builtin, keybinds). It lists shift as a built-in of csh(1) and sh(1) and gives no syntax, argument handling or exit status. The Solnix page documents each shell's shift. Source: FreeBSD shift(1) NAME, DESCRIPTION, Commands table (shift: Standalone No, csh Yes, sh Yes); Solnix shift(1) SYNOPSIS, DESCRIPTION |
| FreeBSD | not a standalone utility | Both systems provide shift only as a shell built-in. The FreeBSD table marks shift Standalone 'No', and Solnix says the command on PATH is a shell built-in, so neither has a /usr/bin/shift.Source: FreeBSD shift(1) Commands table; Solnix bundle header (shell built-in, not a separate binary) |
| FreeBSD | shells covered | Solnix documents shift for sh, csh, ksh and ksh93. FreeBSD lists it only for csh(1) and sh(1). The FreeBSD page does not mention ksh. Source: Solnix shift(1) SYNOPSIS; FreeBSD shift(1) Commands table |
| FreeBSD | csh shift takes a variable name | Solnix csh shift [variable] shifts argv, or the named variable, left. It is an error if the variable is unset or null. The FreeBSD page gives no csh syntax, so the manual does not say whether FreeBSD csh behaves the same way. Source: Solnix shift(1) csh SYNOPSIS and DESCRIPTION; FreeBSD shift(1) Commands table |
| FreeBSD | sh and ksh count argument | Solnix sh and ksh take an optional count n, default 1. In ksh and ksh93, n is evaluated as an arithmetic expression, and shifting a negative number or more than $# places is an error. The FreeBSD page does not document n. Source: Solnix shift(1) sh, ksh and ksh93 DESCRIPTION; FreeBSD shift(1) Commands table |
| FreeBSD | special built-in treatment in ksh | On Solnix, ksh marks shift as '*shift' and ksh93 as '+shift'. Variable assignments before it persist, and an error aborts a script containing it. The FreeBSD page does not describe this. Source: Solnix shift(1) ksh and ksh93 SYNOPSIS and DESCRIPTION; FreeBSD shift(1) (no such text) |
| FreeBSD | exit status | Solnix documents exit status only for ksh93: 0 on success, >0 on error. The Solnix page gives no exit status for sh or csh, and the FreeBSD page gives none at all. Source: Solnix shift(1) ksh93 DESCRIPTION; FreeBSD shift(1) |
Standards
- POSIX: shift is not listed as a POSIX.1-2024 utility in the bundle header.
- Solnix: The page's SEE ALSO points to attributes(7). The bundle text contains no stability table for shift.
- FreeBSD: The FreeBSD page has no STANDARDS section in the bundle.
Writing portable scripts
- Use shift only inside shell scripts and check which shell runs them. Solnix documents sh, csh, ksh and ksh93 variants, and FreeBSD lists csh and sh.
- Before calling shift n, test that n is no larger than $#. ksh93 treats shifting past $# as an error.
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.