minishell is a simple UNIX shell developed as part of the 42 School curriculum. It mimics the behavior of bash with a subset of its features, providing a command-line interface for interacting with the operating system.
- Display a prompt when waiting for a new command.
- Working command history.
- Search and launch the right executable based on the PATH variable or using a relative or an absolute path.
- Support for single and double quotes, preventing the shell from interpreting metacharacters within quotes.
- Redirections:
<for input redirection.>for output redirection.<<for heredoc.>>for appending output redirection.
- Piping: Use
|to connect the output of one command to the input of another. - Environment variable handling, including:
$?for the last executed command's exit status.$_for the last argument of the previous command executed.
- Signal handling for
ctrl-C,ctrl-D, andctrl-\.ctrl-Cdisplays a new prompt on a new line.ctrl-Dexits the shell.ctrl-\does nothing.
- Implementation of the following built-in commands:
echowith-noption.cdwith relative or absolute paths.pwdwithout options.exportwithout options.unsetwithout options.envwithout options or arguments.exitwithout options.
echo [-n] [string ...]: Prints the string to the standard output.cd [path]: Changes the current directory to the specified path.pwd: Prints the current working directory.export [name[=value] ...]: Sets environment variables.unset [name ...]: Unsets environment variables.env: Prints the environment variables.exit: Exits the shell.
- Clone the repository:
git clone https://github.com/yourusername/minishell.git cd minishell
- Build the project:
make make clean
- run it:
./minishell
ctrl-Dto exit.
minishell$ echo "Hello, World!"
Hello, World!
minishell$ pwd
/home/yourusername/minishell
minishell$ export MYVAR="Hello"
minishell$ echo $MYVAR
Hello
minishell$ ls | grep minishell
minishell
minishell$ cat < input.txt > output.txt
minishell$ echo $_
output.txtminishell/
├── include/
│ ├── minishell.h
│ ├── banner.png
├── src/
│ ├── *.c
├── Libft/
│ ├── *.c
│ ├── *.h
├── Makefile
├── README.md- Email: khalilsohail24@gmail.com
- Discord: khalil_sohail
- LinkedIn: LinkedIn Profile
