A simple shell implementation based on bash.
Minishell is a custom implementation of a basic command line interpreter, similar to bash. This project is part of the 42 School curriculum and focuses on process creation, file descriptors, and signal handling in a Unix environment.
- Execute external commands with arguments (e.g.,
ls -la
,grep pattern file
) - Handle executable paths and environment PATH variable
echo
: Display messages with-n
option supportcd
: Change current directorypwd
: Display current working directoryexport
: Set environment variablesunset
: Remove environment variablesenv
: Display environment variablesexit
: Exit the shell with status code
- Input redirection (
<
) - Output redirection (
>
) - Append output (
>>
) - Here documents (
<<
) - Pipes (
|
) to connect commands
- Environment variable expansion (e.g.,
$USER
,$PATH
) - Exit status variable (
$?
)
- Ctrl+C (SIGINT): Interrupt current process
- Ctrl+D (EOF): Exit shell
- Ctrl+\ (SIGQUIT): Ignored in interactive mode
git clone https://github.com/yourusername/minishell.git
cd minishell
make
./minishell
Basic command execution:
> ls -la
Redirections:
> echo "Hello" > file.txt
> cat < file.txt
Pipes:
> ls -la | grep .c
Environment variables:
> echo $USER
> export VAR=value
> echo $VAR
- Lexer/Parser: Tokenizes and analyzes user input
- Command Execution: Creates child processes using fork and execve
- Redirections: Manages file descriptors for I/O operations
- Environment Management: Handles environment variables in a linked list
- Signal Handling: Custom signal handlers for terminal signals
- GNU Readline library
@ma1loc for @me i did the execution part
This project was completed as part of the 42 School curriculum.