A UNIX shell that emulates BASH behavior. Created in collaboration with @Kirkram.
MiniBash is a lightweight UNIX shell that mimics BASH behavior. It supports:
- Command execution with arguments
- Pipes (
|) to chain commands - Redirections (
<,<<,>,>>) - Environment variable handling (
$VAR) - POSIX signal handling
The project was divided into two main parts:
✔️ Command Execution – Supports absolute & relative paths
✔️ Pipes (|) – Execute multiple commands in a single line
✔️ Redirections (<, <<, >, >>) – Handle file input/output
✔️ Environment Variables ($VAR) – Expand shell variables
✔️ Signal Handling – Manage CTRL+C, CTRL+D, CTRL+\
✔️ Built-in Commands – Custom implementations of key shell commands
We implemented the following BASH built-in commands:
| Command | Description |
|---|---|
cd |
Change the working directory |
pwd |
Print the current directory |
export |
Set environment variables |
unset |
Remove environment variables |
env |
Display all environment variables |
echo |
Print text to the terminal |
exit |
Exit the shell |
Other commands are executed using the execve() system call.
git clone https://github.com/Welhox/MiniBash.git
cd MiniBashEnsure you have the readline library installed before compiling:
On Debian-based systems (Ubuntu):
sudo apt install libreadline-devOn MacOS (Homebrew):
brew install readlinemakeThis will generate the minishell executable.
Run MiniBash by executing:
./minishellYou can now enter commands just like in BASH!
