Minimal Unix shell with pipes and redirection, in C.
A small, self-contained demo written in pure C — no external libraries, just the standard library and POSIX. Part of the Corg-Labs collection of single-file C programs.
- A command line is split on the pipe character into stages
- fork() + execvp() run each stage as a child process
- pipe() and dup2() wire one stage's output to the next's input
- < and > redirect a stage's input/output to files
gcc cshell.c -o cshell
./cshell
Built-ins: cd, exit. Try ls | grep .c | wc -l or cat < in > out.