Minishell is a lightweight Unix shell implementation that provides a basic command-line interface for executing commands and managing processes. This project is designed to help you understand shell concepts, process management, and command execution in Unix-like systems. π
- Implement a basic Unix shell that can interpret and execute commands.
- Support built-in commands and external commands with arguments.
- Manage processes, handle input/output redirection, and implement piping between commands.
- Execute External Commands: Run programs and scripts from the command line.
- Support for Arguments: Pass arguments to commands and handle them appropriately.
cd
: Change the current working directory.pwd
: Print the current working directory.echo
: Display a line of text.exit
: Exit the shell with a specified exit status.
- Redirect Input: Use
<
to redirect input from a file. - Redirect Output: Use
>
to redirect output to a file. - Append Output: Use
>>
to append output to a file.
- Pipe Commands: Use
|
to pass the output of one command as input to another.
.
βββ LICENSE
βββ Makefile
βββ README.md
βββ en.subject.pdf
βββ srcs
βββ cd.c
βββ cd2.c
βββ check_builtins.c
βββ cmd.c
βββ create_lexer.c
βββ dollar.c
βββ echo.c
βββ env.c
βββ exec_builtins.c
βββ exec_utils.c
βββ exec_utils2.c
βββ execute.c
βββ execute_bin.c
βββ execute_bin2.c
βββ execution_utils.c
βββ exit.c
βββ expand_value.c
βββ expander.c
βββ expander_utils.c
βββ export.c
βββ export2.c
βββ export_tools.c
βββ free.c
βββ ft_env.c
βββ ft_error.c
βββ heredoc.c
βββ lexing.c
βββ lexing_utils.c
βββ libft.c
βββ libft2.c
βββ list.c
βββ main.c
βββ main_helper.c
βββ minishell.h
βββ parse_args.c
βββ parsing.c
βββ parsing_error.c
βββ parsing_redirction.c
βββ parsing_utils.c
βββ parsing_utils2.c
βββ pipe_execution.c
βββ pwd.c
βββ quote.c
βββ syntax.c
βββ syntax_utils.c
βββ t.c
βββ t2.c
βββ test.c
βββ unset.c
βββ update_oradd_env.c
2 directories, 54 files
To compile the project, use the provided Makefile
:
make
This will generate an executable called minishell
.
To run the shell, execute the minishell
binary:
./minishell
You will enter the shell prompt where you can type commands and interact with the shell.
- List Files:
ls -l
- Change Directory:
cd /path/to/directory
- Print Working Directory:
pwd
- Redirect Output to a File:
echo "Hello World" > output.txt
- Pipe Commands:
cat file.txt | grep "keyword"
Test your shell by:
- Executing a variety of commands and built-in commands.
- Using input/output redirection to handle files.
- Testing piping between multiple commands.
- Checking edge cases like invalid commands or syntax errors.
By completing this project, you will:
- Gain a solid understanding of how Unix shells work.
- Learn about process creation, management, and synchronization.
- Understand command parsing, redirection, and piping in a shell environment.
For additional practice and enhancement, consider the following:
- Job Control: Implement job control features like background processes and signal handling.
- Command History: Add support for command history and navigation.
- Tab Completion: Implement tab completion for commands and file paths.
This project is open-source and available under the MIT License. Feel free to fork, modify, and contribute!