This project is about creating a simple shell. Yes, your own little bash 🙂
Handle process creation and management using fork()
, execve()
, and wait()
functions. This involves correctly forking new processes to execute commands, managing process IDs, and ensuring effective communication between parent and child processes.
Implement input/output redirections, which requires a solid grasp of how file descriptors work in Unix-like systems. Handle input (<
), output (>
), append (>>
), and heredoc (<<
).
Gracefully handle signals like ctrl-C
, ctrl-D
, and ctrl-\
, ensuring they interact correctly with the shell's state and processes. Implementing signal handlers to manage interrupts without disrupting the shell's functionality.
Allocate and free memory properly to avoid leaks, especially when dealing with dynamic inputs and environment variables. This involves understanding and correctly using functions like malloc()
and free()
.
We created ft_destructor that helped use to secure each allocation and free everything in case of error.
Correctly parse user inputs to interpret and execute commands. Handle different types of quotes, and special symbols required by subject while maintaining the correct execution order.
Implement built-in commands such as cd
, echo
, pwd
, export
, unset
, env
, and exit
with their expected behaviors. Each command has its own set of rules and nuances that need to be replicated accurately.
Adhere to coding standards (the Norm) while implementing all features. Ensuring your code is clean, maintainable, and free of norm errors
Yes, this was painfull (btw dogs don't have this problem)
Clone the repository and build
git clone https://github.com/Emsa001/42minishell
cd ./42minishell
make
Run the program
./minishell
Example Commands:
echo Hello $USER
export x1="two words"
printf "%s\n" $x1
ls *s*
cat | cat | cat | ls
false && echo 123
true && echo 123