Minishell is a simple shell implementation, part of the 42 school curriculum. This project aims to create a basic command-line interpreter similar to bash, helping students understand the fundamentals of processes, file descriptors, and command execution in Unix-like operating systems.
Our minishell implements the following features:
- Command Prompt: Displays a prompt when waiting for a new command.
- Command History: Maintains a working history of commands.
- Executable Search and Launch:
- Searches and launches the right executable based on the PATH variable.
- Supports relative or absolute paths.
- Quote Handling:
- Handles single quotes (') to prevent interpretation of meta-characters.
- Handles double quotes (") while still interpreting $ (dollar sign).
- Redirections:
- < : Input redirection
-
: Output redirection
- << : Here document (delimiter-based input)
-
: Output redirection in append mode
- Pipes: Implements pipes (|) to connect the output of one command to the input of the next.
- Environment Variables:
- Expands environment variables ($ followed by characters).
- Handles $? to expand to the exit status of the most recently executed foreground pipeline.
- Signal Handling:
- Ctrl-C: Displays a new prompt on a new line.
- Ctrl-D: Exits the shell.
- Ctrl-: Does nothing.
- Built-in Commands:
- echo with option -n
- cd with relative or absolute path
- pwd with no options
- export with no options
- unset with no options
- env with no options or arguments
- exit with no options
first install the readline
library:
on fedora based systems:
sudo yum install readline-devel
on debian based systems:
sudo apt-get install lib32readline-dev lib32readline-dev
Use the provided Makefile to compile the project:
make
This will compile the minishell executable.
After compilation, run the minishell:
./minishell
You can then enter commands as you would in a regular shell.
This project is part of the 42 school curriculum and adheres to specific guidelines and restrictions. It's designed as a learning exercise and may not include all features of a full-fledged shell.