A simplified Unix-like shell implemented in C.
It supports executing built-in and external commands, handling environment variables, and managing input/output redirection, pipes, and sequential execution.
This project replicates the core functionality of a command-line interpreter.
It parses commands, executes them via system calls (fork, execvp, dup2, waitpid), and manages redirections and environment variables dynamically.
Language: C
Focus: System calls, process management, I/O redirection, shell parsing
cd— change the current working directory (cd,cd ..,cd -,cd ~)exit/quit— close the shell and free resources
- Supports assignments (
VAR=value) and variable expansion ($VAR) - Allows dynamic updates using
setenvandgetenv
- Runs external programs via
execvp - Supports conditional execution (
&&,||), sequencing (;), and piping (|) - Implements input (
<), output (>), append (>>), and error redirection (2>,2>>)
cmd.c— core command execution (built-ins, redirections, pipes, conditions)utils.c— string parsing and argument handling forexecvpmain.c— user input loop, command parsing, and interactive shell interface
VAR=hello
echo $VAR
hello
cd ..
ls -l | grep ".c"
exit
- Implemented process creation, synchronization, and inter-process communication.
- Practiced redirection, piping, and file descriptor manipulation.
- Deepened understanding of command parsing and execution in Unix systems.