42 Project minishell
is a simple shell implementation written in C. It supports basic shell functionalities such as command execution, piping, redirection, and built-in commands.
Screen.Recording.2024-09-22.at.11.12.18.PM.mov
- Command execution
- Input and output redirection
- Piping
- Built-in commands (
cd
,echo
,pwd
,export
,unset
,env
,exit
) - Signal handling
- Environment variable management
To understand the features of minishell, the test.sh file would be a good starting point.
This project follows an incremental development approach, where the program is built step-by-step, ensuring it functions as a shell at each stage. The process involves reading documentation, executing sample code, writing tests, and revising code iteratively. The incremental method simplifies coding, understanding, and testing, ultimately speeding up development. For detailed steps, you can find my write up here.
To install and build Minishell, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/minishell.git cd minishell
-
Install dependencies:
brew install readline
-
Build the project:
make
To start the shell, run the following command:
./minishell
You will see a prompt like this:
minishell$
You can now enter commands just like you would in a regular shell.
The project is organized as follows:
src/
: Contains the source code for the shell.main.c
: Entry point of the shell.tokenize/
: Tokenization logic.parse/
: Parsing logic.expand/
: Expansion logic.redirect/
: Redirection logic.exec/
: Execution logic.builtin/
: Built-in command implementations.signal/
: Signal handling logic.lib/
: Utility functions.environ/
: Environment variable management.pipe/
: Piping logic.error/
: Error handling logic.
include/
: Contains header files.minishell.h
: Main header file for the shell.
libft/
: Contains the my own libc like functions.Makefile
: Build script for the project.test.sh
: Script for running tests.
This project was developed with the support and guidance of various resources and tools. Special thanks to:
- The 42 Network for providing the project framework and learning environment.
- 42 peers for their help and feedback.
- ChatGPT-4o for assisting in generating this README.
- The authors of "The Linux Programming Interface" and "Advanced Programming in the UNIX Environment" for their invaluable reference materials.