A minimal command-line shell written in C, inspired by Stephen Brennan’s Write a Shell in C tutorial. This project serves as both a learning tool and a foundation for building more advanced shell features.
- Built-in commands:
cd– change directories (supportscd,cd ..)help– display information about built-in commandsexit– exit the shell
- Executes external programs using
forkandexecvp - Displays a prompt showing the current working directory
- Input is parsed into tokens using
strtok - Makefile included for easy compilation
- Command history with arrow key navigation
- Line editing (backspace, cursor movement)
- Command chaining with
&&,||, and; - Input and output redirection (
<,>,>>) - Piping support (
|) - Background job execution with
& - Prompt formatting with support for
~, username, and hostname - Environment variable expansion (e.g.,
$HOME,$PATH)
To compile the shell:
makeTo run the shell
./gsh