How sohe1l/unix-shell works
This repository is a compact interactive shell. Its main workflow reads a command line, tokenizes and interprets arguments, pipes, redirects, and background markers, then handles built-ins or launches external programs. The single source file also implements prompt/path display, directory changes, child-process execution, and pipe forwarding. The README documents nested pipes and tilde support; source excerpts show the main parsing and execution mechanisms, though some documented combinations are not independently verified here.
Main entry points: myshell.c Process launcher
Components 11
Shell runtime
- Input reader
myshell.c - Command parser
myshell.c - Built-in commands
myshell.c - Prompt and cwd
myshell.c - Directory change
myshell.c
Command execution
- Process launcher
myshell.c - File redirection
myshell.c - Pipe forwarding
myshell.c
Other components
- Terminal user
- External program
- Redirected files
Connections 12
- Terminal user → Input reader: enters commands
myshell.c - Input reader → Command parser: tokenizes input
myshell.c - Command parser → Built-in commands: dispatches built-ins
myshell.c - Built-in commands → Directory change: changes directory
myshell.c - Command parser → Process launcher: launches commands
myshell.c - Process launcher → External program: executes via execvp
myshell.c - Process launcher → File redirection: applies redirects
myshell.c - File redirection → Redirected files: opens files
myshell.c - Process launcher → Pipe forwarding: sets up pipes
myshell.c - Pipe forwarding → Process launcher: forwards pipe input
myshell.c - Prompt and cwd → Terminal user: prints prompt
myshell.c - Built-in commands → Prompt and cwd: reads cwd
myshell.c