A simple Unix shell recreated in C as part of the 42 school curriculum. The project aims to deepen understanding of process creation, file descriptors, parsing, and terminal behaviors by implementing core shell features from scratch.
Minishell is a simple shell built in C, mimicking behavior of Bash for essential features. It allows execution of user commands, supports built-in functions, handles redirections and pipelines, and includes basic environment variable expansion.
This project strengthens skills in:
- Process management (fork, execve, wait)
- Input parsing & tokenization
- Signal handling (SIGINT, SIGQUIT)
- File descriptor manipulation
- Linked list data structures
- Memory and error management
- β Prompt display and interactive input loop
- β Command execution (both built-in and system binaries)
- β
Built-in commands:
cd
,echo
,env
,exit
,export
,pwd
,unset
- β
Environment variable support (
$VAR
) - β
Redirections:
<
,>
,>>
,<<
(heredoc) - β
Piping with
|
- β
Quote handling (
'
,"
) with proper parsing - β
Signal management (e.g.,
Ctrl-C
,Ctrl-\
) - β Error handling (syntax and execution)
- β Exit status propagation
- These are not required but can boost your grade or show off your skills:
- Wildcard expansion (*)
- Subshells: (...)
- Logical operators: &&, ||
- Command grouping with {} or (...)
- History handling (using readline)
- Line editing (readline handles this)
- Custom builtins (e.g., help or clear)
# Clone the repo
git clone https://github.com/aelsayed1337/minishell.git
cd minishell
# Compile
make
# Run
./minishell
$ echo "Hello World"
$ export USERNAME=amin
$ echo $USERNAME
$ ls -l | grep ".c" > sources.txt
$ cat << EOF
> multiline
> input
> EOF
- Language: C (C89/C99)
- Libraries:
readline
, standard C libs, libft - Structures: Custom AST for command parsing, linked lists for token tracking
- Memory: Fully leak-free (checked with Valgrind)
minishell/
β
βββ libft/ # Custom standard C library
βββ parsing/ # Tokenizer and syntax parser
βββ execution/ # Command execution & redirection
βββ builtins/ # Built-in commands
βββ Makefile
- Amine ELSAYED (@elsayedamine)
- Aziz HAKKI (@a-hakki)