Bash-like shell in C
Minishell is a 42 school project that implements a simplified bash-like shell. This project teaches fundamental concepts of:
- Process management — Creating and managing child processes
- File descriptors — Input/output redirection
- Pipes — Connecting commands together
- Environment variables — Managing shell environment
- Signal handling — Responding to user signals
- 🔧 Built-in Commands —
echo,cd,pwd,export,exit,unset - ⚡ Command Execution — External commands via
execve - 📥 Input Redirection —
<operator - 📤 Output Redirection —
>and>>operators - 🔗 Pipes —
|operator for command chaining - 🌍 Environment Variables —
$VARexpansion - 📢 Signal Handling —
Ctrl+C,Ctrl+D,Ctrl+\
- C compiler (gcc or clang)
- Make
- Unix-like system (Linux or macOS)
-
Clone the repository:
git clone https://github.com/manugonz42/minishell.git cd minishell -
Compile the project:
make
-
Run the shell:
./minishell
| Command | Description |
|---|---|
echo |
Display text |
cd |
Change directory |
pwd |
Print working directory |
export |
Set environment variable |
unset |
Remove environment variable |
env |
Print environment |
exit |
Exit the shell |
Any command available in your $PATH can be executed.
# Basic commands
ls -la
cat file.txt
# Redirections
echo "Hello" > file.txt
cat < file.txt >> output.txt
# Pipes
ls -la | grep ".txt"
cat file.txt | wc -l
# Environment variables
export MY_VAR="Hello"
echo $MY_VARContributions are welcome! Please read our Contributing Guide for details.
This project is part of 42 School curriculum.
Manuel González - LinkedIn - [email protected]
Project Link: https://github.com/manugonz42/minishell