Compatibility notes

This page records known compatibility differences when POSIX, Bash, or common system shells are useful reference points.

This is not a full matrix. For decision rules, see the conformance policy.

C locale shell semantics

Rush uses POSIX/C-locale shell semantics. LC_COLLATE and LC_CTYPE do not alter pathname ordering, bracket expression collation, or character classes.

Rush sorts pathname expansion matches by byte value. Locale-aware shells may order mixed-case names differently:

touch b a AGENTS.md LICENSE README.md
printf '<%s>\n' *

Rush prints uppercase names before lowercase names. Set LC_ALL=C before relying on portable pathname order.

POSIX mode

Assigning defaults to positional parameters

Rush treats required ${parameter:=word} assignment to a positional parameter as a fatal expansion error.

set -- ''
printf '%s\n' ${1:=fallback}
printf 'after\n'

POSIX := assigns only shell variables. Rush reports the error and does not print after. This matches dash, ksh93, and yash. Bash POSIX mode reports the error but continues.

Non-integer variables in arithmetic expansion

Rush treats non-integer variable contents as an arithmetic expansion error when used as an operand.

x=abc
printf '%s\n' "$((x))"
printf 'after\n'

Rush reports the error and does not print after. This matches dash and ksh93. Bash POSIX mode expands this case to 0 and continues.

Invalid break and continue counts

Rush treats non-positive or non-decimal break/continue operands as fatal errors in non-interactive shells.

for x in a b
do
  break 0
  printf 'after\n'
done

Rush reports the error and exits. This matches dash and yash. Bash POSIX mode reports status 1 for the failed special builtin and continues.

Bash

Bash 3.2

macOS still ships Bash 3.2 as /bin/bash. Rush does not treat it as the sole Bash target.

Unsetting readonly variables in POSIX mode

In non-interactive POSIX mode, unsetting a readonly variable is fatal.

readonly ro=value
unset ro
printf 'after\n'

Rush reports the error and does not print after. This matches dash and modern Bash POSIX mode. Bash 3.2 POSIX mode reports the error but continues executing the script.

POSIX case fall-through with ;&

Rush accepts POSIX ;&: execute the matching clause, then continue through later clause bodies until ;; or esac.

case x in
  x) printf 'one\n' ;&
  y) printf 'two\n' ;;
esac

Rush and modern Bash POSIX mode print both lines. Bash 3.2 POSIX mode rejects ;& as a syntax error.

Bash case test-next with ;;& in POSIX mode

Rush supports Bash-style ;;& in default mode and rejects it under --posix. POSIX defines ;; and ;&, not ;;&.

Bash 5.3 accepts ;;& even with --posix. Rush keeps --posix stricter.

Alias substitution after leading redirections in POSIX mode

Rush checks the first command word for aliases even after leading redirections.

alias say='printf alias-hit\\n'
>/tmp/rush-alias.out say
cat /tmp/rush-alias.out

Rush, dash, yash, and modern Bash POSIX mode print alias-hit. Bash 3.2 POSIX mode does not expand the alias in this position, so the command search sees say instead.