Welcome to your Minishell journey! This README provides a full guide on what you need to learn and implement to successfully complete the mandatory part of the Minishell project.
By building Minishell, you’ll learn:
- How shells work internally
- Parsing and executing commands
- Managing processes and file descriptors
- Handling pipes and redirections
- Managing environment variables
- Implementing built-in commands
- Signal handling
- What is a shell and how does it work?
- Shells vs terminals
- Execution flow of a command like
ls -l
Make sure you're confident with:
malloc,free,realloc- String manipulation:
strdup,strtok,strchr,strncmp - File descriptors:
read,write,open,close - Understanding and using arrays of strings (
char **)
Key system calls:
fork()- create a new processexecve()- replace process imagewait()/waitpid()- wait for child processexit()- return exit code
💡 Each command will be run in a child process using these calls.
- Understand
char **envpinmain - How to copy and modify environment variables
- Implement
env,export,unset
You’ll maintain your own internal env list and update it as needed.
Implement these:
echo(with-n)cdpwdexportunsetenvexit
💡 Only cd, exit, and export must be run in the parent process.
You’ll write a custom parser to:
- Split input by spaces while respecting:
- Quotes
'like this',"like this" - Environment variables:
$HOME,$?
- Quotes
- Detect syntax errors
- Handle escape sequences and empty inputs
Example:
echo "Hello $USER" | grep "o" > output.txt