Minishell is a minimalist shell. It is a smaller, educational version of a Unix shell like bash or zsh, created to learn how shells operate, manage processes, and handle user input.
- Basic command execution (e.g.,
ls,echo,pwd) - Handling of built-in shell commands (
cd,echo,exit,export,pwdunset) - Input and output redirection (
>,<,>>,<<) - Pipelining with
| - Environment variable handling and expansions
- Signal handling (e.g.,
Ctrl+Cto terminate a running command andCtrl+D)
To install and set up Minishell, follow these steps:
-
Clone the repository:
git clone https://github.com/uuuuuvika/minishell.git cd minishell -
Build the project:
make m
This will compile the source code and run the executable named
minishell.
To start using Minishell, run the following command in your terminal:
./minishellYou will be greeted with a prompt where you can start typing commands.
Minishell supports both built-in commands and external commands available in your system's PATH.
cd [directory]: Change the current directory to directory.
cd ..: Move to the parent directory.
cd ~: Move to the home directory.
cd .: Stay in the current directory.
exit [status]: Exit the shell with an optional exit status.
echo [string]: Print string to the terminal.
echo -n [string]: Print string without a trailing newline.
env: Print all environment variables.
export [var]=[value]: Set an environment variable var to value.
unset [var]: Remove the environment variable var.
Any executable found in the directories listed in the PATH environment variable can be executed. For example:
ls -lagrep "pattern" file.txt
-
Output Redirection: Use
>to redirect output to a file.echo "Hello, World!" > hello.txt -
Append Output Redirection: Use
>>to redirect output to a file, appending to the file if it exists.echo "Hello, again!" >> hello.txt -
Input Redirection: Use
<to redirect input from a file.cat < hello.txt -
Here Document: Use
<<to redirect input from a string until a delimiter is found.cat << EOF Hello, World! EOF
Use | to pipe the output of one command as the input to another.
ls -la | grep "pattern"This Minishell is a project of the 42 Berlin curriculum designed and written in collaboration by uuuuuvika and ProjectDaiana
For any questions or suggestions, please feel free to open an issue or contact the project maintainers.
