Phase 3: $(...), aliases, a start-up file, PROMPT, Done lines, >&2

- $(...) runs in a subshell. A word that is only an unquoted $(...) is
  one word per line. X=$(cmd) sets $? to its status.
- alias, unalias, and command NAME. An alias is one pipe.
- ~/.config/bjosh/rc runs before the first prompt.
- PROMPT, expanded as in double quotes, with \w \W \u \h \$ \e \n.
- "Done" lines are written above the input while the prompt waits.
- >&2, for programs and value commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-12-01 09:50:15 +01:00
parent f54ceb35af
commit f8c4ad64bc
13 changed files with 680 additions and 128 deletions

View file

@ -107,9 +107,13 @@
(expect "< after another value command" (c "n | so < a.txt")
"err: bjosh: so: < on a value command after another one\ncode: 2")
(expect "a value command after >" (c "l > f | n")
"err: bjosh: n: the value command before it writes to a file, so nothing can be piped into it\ncode: 2")
"err: bjosh: n: the value command before it writes to a file or to stderr, so nothing can be piped into it\ncode: 2")
(expect "2> of a value command" (c "l 2> e")
"err: bjosh: l: 2>, 2>&1 and >&2 of value commands are not supported yet\ncode: 2")
"err: bjosh: l: 2> and 2>&1 of value commands are not supported yet\ncode: 2")
(expect ">&2 of a value command" (c "l >&2 | n")
"err: bjosh: n: the value command before it writes to a file or to stderr, so nothing can be piped into it\ncode: 2")
(expect ">&2 at the end writes lines" (c "l | g name | hd 1 >&2") "err: a.txt")
(expect ">&2 after a program" (c "printf 'b\\na\\n' | so >&2; echo done") "done\nerr: a\nb")
(expect "an assignment of a value command" (c "X=1 l")
"err: bjosh: l: assignments of value commands are not supported\ncode: 2")