Minishell is a simple shell implementation in C. It is a project from the 42 school curriculum. The goal of this project is to create a simple shell that can handle basic commands, environment variables, and signal handling, it also has to be able to handle redirections and pipes. it also has a group of built-in commands that are implemented in C.
- Clone the repository:
git clone https://github.com/abouabra/42-Minishell.git- Change the current working directory:
cd 42-Minishell- Compile the project:
make- Run the program:
./minishellMinishell provides the following features:
- Command execution: Minishell can execute commands entered by the user, including built-in commands and external programs.
- Quoting: Minishell supports single and double quotes to group arguments together.
- Built-in commands: Minishell supports built-in commands such as
cd,echo,pwd,export,unset,env, andexit. - Environment variables: Minishell can manage environment variables it including displaying using the
$symbol, exporting, and unsetting variables. - Input/output redirection: Minishell supports input/output redirection using
<,>, and>>symbols. - Pipes: Minishell supports piping multiple commands together using the
|symbol. - Signal handling: Minishell handles signals such as
Ctrl+C(SIGINT) andCtrl+\(SIGQUIT) gracefully. - Error handling: Minishell provides informative error messages when commands fail to execute.
- Command history: Minishell supports command history using the
upanddownarrow keys. - support for wildcard expansion using the
*symbol. &&and||operators for conditional execution of commands.
Once you have compiled the minishell program and run it, you can start using it as follows:
- Enter commands at the prompt and press Enter to execute them. For example:
$ ls -l- Use built-in commands such as
cd,echo,exit, andenvas needed. For example:
$ cd <directory>- Use input/output redirection and pipes to perform more complex operations. For example:
$ ls -l > output.txt
$ cat input.txt | grep "pattern"- use the * wildcard to match any character in a file name. For example:
$ ls *.c- use the && and || operators for conditional execution of commands. For example:
$ ls -l && echo "ls succeeded" || echo "ls failed"- To exit Minishell, use the
exitcommand:
$ exitIf you have any suggestions or improvements, feel free to open an issue or submit a pull request.