MMotor OS
Userspace

rush: the shell

rush ("RUst SHell") is a POSIX-style shell written in Rust with minimal dependencies, so that it ports to an operating system that is not Unix. It is the console shell and the SSH login shell of Motor OS, and it also builds and runs on Linux.

Conformance is measured rather than asserted: a corpus of POSIX snippets is run through both rush and dash, and the two must agree on stdout and exit status. The deliberate differences are listed in the test file, and each is itself tested, so a difference cannot be quietly introduced or quietly fixed.

Interactive use

The language

Builtins

Special: : . eval exec exit export readonly set shift unset times trap break continue return. Regular: cd pwd echo printf test [ read true false getopts command type hash alias unalias umask wait jobs fg bg kill. Extensions: history, clear, and quit.

Deliberate differences from dash

set -o pipefail exists (POSIX.1-2024 added it). -h is accepted as an inert option. $- lists options in a fixed order. set -v echoes a script in one piece, since rush reads a whole script before parsing it. The default prompt is colored (PS1='$ ' restores dash's). history, clear, and quit are builtins; clear is one the Motor OS image needs because it ships no external clear. Aliases expand at execution rather than parse time, so alias e=echo; e hi works in a single -c string.

Motor OS specifics

A System-role console shell explicitly grants CAP_SYS to the commands it runs, because the default spawn rule never propagates System; an Interactive shell's commands inherit Interactive by the default rule. A per-command MOTOR_OS_CAPS=... command assignment replaces that grant and can narrow the child. Programs on rush's detached-spawn list, such as rmux, are started with CAP_SPAWN_DETACHED so that they can leave a server running after the session ends. Background jobs are started without the terminal input stream, since Motor has no SIGTTIN to stop them from stealing keystrokes, and for the same reason there is no interactive job control (^Z, bg): a foreground command runs until it exits or is interrupted. rush re-exports $COLUMNS and $LINES before every command so that a full-screen program starts at the right size, and it sets the rmux window title to the foreground command's name.