Shell follow-ups
/apps/sh.elf is already the default interactive shell. Pipes, redirection,
&&, ||, background &, and wait are present today. This page tracks the
remaining POSIX-shaped shell work.
The goal is not to clone every feature of bash. The target is a small
portable /bin/sh-style environment good enough for configure-like scripts,
toolchain bootstrapping, and normal OS use inside Makar.
Current baseline
Already available in /apps/sh.elf:
- PATH lookup for executables in
/appsand other configured directories. - Quote-aware command parsing for the supported grammar.
sh -c.fork/execve/wait4-based command execution.- Pipes via
SYS_PIPE. - Redirection via fd duplication and file opens.
&&and||list operators.- Background jobs with
&. waitfor child completion.
The in-kernel script runner is separate and intentionally smaller; do not use it as the compatibility target for POSIX shell work.
Parsing and expansion
- Double and single quotes with correct expansion rules.
- Backslash escapes.
- Inline
NAME=VALUE commandassignments. - Command substitution with
$(command). - Positional parameters:
$0through$9,$#,$@, and$*. - Shell PID and last background PID:
$$and$!.
Control flow
case ... esac.- Functions,
return, and function-local variables. break Nandcontinue N.- Subshells with
( ... ).
Environment
- Pass a real
envpthroughexecve. - Add
export. - Add shell options such as
set -e,set -u, andset -x.
Job control
- Add
jobs,fg, andbg. - Add process groups and a
tcsetpgrpequivalent before claiming real foreground job control. - Add richer signal handling where job control needs it.
Smaller builtins and polish
- Add
alias,unalias,type,which,getopts, andprintf. - Add
cd -and tilde expansion. - Complete command names from
PATHand variables after$.
Suggested order
- Quote-aware tokenization and escapes.
- Real
envp,export, and inline assignments. - Positional parameters and functions.
- Command substitution and subshells.
- Process groups and interactive job control.