42sh
We rebuilt the Unix shell developers type into all day: a tcsh-compatible shell in C that turns each command line into a syntax tree and runs it, with pipes, redirections, subshells, variables, aliases, history and background jobs, checked output for output against the real tcsh.
Team
4 people
Context
Epitech project, 1st year
Status
Done
Context
Epitech's 1st-year Unix programming project: write a shell that behaves like tcsh, with the same output, error messages and exit codes, using only system calls such as fork, execve, pipe and dup2.
What was built
- Parser that builds a syntax tree by operator precedence: ; and background jobs, then ||, &&, redirections, pipes and parenthesised subshells
- Expansion of $variables and $?, `command` substitution, aliases, !N history and *?[ ] globbing
- Built-ins: cd, env, setenv, unsetenv, set, unset, alias, unalias, which, where, repeat, history, jobs, fg, exit
- Job control with process groups, and a test script that compares every case with tcsh
Results
15built-in commands
44unit tests
