Minishell is a project designed to create a simple, custom shell in C, closely mimicking the functionality of Bash. The project focuses on understanding processes, file descriptors, and various shell operations. This README provides a detailed guide on the structure, functionality, and usage of the Minishell project.
The existence of shells is linked to the very existence of IT. Initially, developers used aligned 1/0 switches to communicate with computers, which was quite cumbersome. The invention of shells allowed interactive command-line communication in a language closer to human language. With Minishell, we revisit the fundamental problems faced before modern GUIs and sophisticated shells like Bash.
Minishell includes the following features:
<
), output (>
), append (>>
), and here-document (<<
) redirections.|
) to connect the output of one command to the input of another.$?
for the exit status of the most recently executed foreground pipeline.ctrl-C
, ctrl-D
, and ctrl-\
signals as in Bash.echo
, cd
, pwd
, export
, unset
, env
, and exit
.To install and run Minishell, follow these steps:
Clone the Repository
git clone <repository-url>
cd minishell
Build the Project
make
Run Minishell
./minishell
Once Minishell is running, you can use it similarly to Bash:
Basic Commands
ls -l
echo "Hello, World!"
Redirections
cat < input.txt
echo "New content" > output.txt
echo "Append this" >> output.txt
cat << EOF
> This is a
> here-document example
> EOF
Pipes
ls -l | grep minishell
Environment Variables
echo $HOME
echo $?
Signal Handling
ctrl-C
: Displays a new prompt on a new line.ctrl-D
: Exits the shell.ctrl-\
: Does nothing.Minishell implements several built-in commands:
echo
echo -n "No newline"
cd
cd /path/to/directory
pwd
pwd
export
export VAR=value
unset
unset VAR
env
env
exit
exit