. "$BST_LIB" require dash dash/present # basic command execution via -c (runs in the shell process, no fork/exec) check_out dash/echo "hello" dash -c 'echo hello' # POSIX arithmetic expansion check_out dash/arith "42" dash -c 'echo $((6 * 7))' # POSIX parameter expansion (prefix strip) check_out dash/param "def" dash -c 'x=abcdef; echo ${x#abc}' # control flow: for-loop counting check_out dash/loop "4" dash -c 'n=0; for i in a b c d; do n=$((n+1)); done; echo $n' # exit-status propagation (dash signals via rc, so assert on rc directly) check_rc dash/exit 3 dash -c 'exit 3' # executes a real script file, not just -c: while-loop to a fixed count tmp=${TMPDIR:-/tmp}/bst-dash.$$ printf '%s\n' '#!/bin/dash' 'i=0' 'while [ $i -lt 5 ]; do i=$((i+1)); done' 'echo done=$i' > "$tmp.sh" 2>/dev/null check_out dash/scriptfile "done=5" dash "$tmp.sh" rm -f "$tmp.sh"