Minishell is a basic bash program implemented in C. It provides functionality for executing commands, handling redirections and pipes, expanding environment variables, and implementing built-in commands such as cd
, echo
, env
, exit
, export
, pwd
, and unset
.
The Minishell project aims to create a simplified version of a shell, offering users a command-line interface to interact with the operating system. By implementing core shell features and built-in commands, developers gain a deeper understanding of system programming and shell functionalities.
- Execute commands and programs.
- System executables available from the environment (
ls
,cat
,grep
, etc.) - Implement pipes (
|
) to chain commands together. - Support for input/output redirection (
<
,>
).>
redirects the output.>>
redirects the output in append mode.<
redirects input<< DELIMITER
prompts for input until DELIMITER is reached, redirecting it to the command without updating history.
- Expand environment variables (e.g.,
$HOME
,$PATH
).$USER
expands the variable."$USER"
expands the variable.'$USER'
doesnt expand the variable.
- Handle built-in commands such as
cd
,echo
,env
,exit
,export
,pwd
, andunset
. - Implement signal handling to manage interrupts and signals gracefully:
ctrl-c
displays a new prompt line.ctrl-d
exits minishell.ctrl-\
does nothing.
- Error handling
To run the project, first clone the repository and navigate into the project directory. Then, use the make
command to compile the project.
Once the project is compiled, you can run it with the following command:
./minishell
Then, you can interact with the Minishell and execute commands as you would in a standard shell. Some examples below:
1. Change directory:
``` bash
cd /path/to/directory
- Execute a program:
./program_name
- Pipe commands together:
command1 | command2
- Redirect input/output:
command < input_file > output_file
- Set and export variables:
export VARIABLE_NAME=value
Made by dardangerguri and jhesso.