Skip to content

deryaxacar/42-Minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

42 - Minishell ⌨️

This project aims to build a basic command-line shell. The shell processes user input, executes commands, handles file redirection, and manages pipes. Minishell is a great tool for understanding how a shell works by implementing core shell functionalities.

Project Goal 🎯

The goal of the Minishell project is to create a simple UNIX-like shell. It involves handling user input, parsing and executing commands, implementing file redirection and pipe operations. This project provides in-depth knowledge on system calls, memory management, and string manipulation in the C programming language.

Usage Scenarios 🖥️

Minishell operates similarly to a standard shell and supports various functionalities. Here are some usage examples:

  • Command Execution: Type simple commands and press Enter.
    • Example: ls -l
  • File Redirection: Use '>' or '>>' to redirect output to a file, and '<' to read input from a file.
    • Example: echo "Hello World" > output.txt
  • Pipe Operations: Use '|' to pass the output of one command as input to another.
    • Example: ls -l | grep minishell
  • Check Command Result: $? returns the exit status of the last executed command.
    • Example: ls -l; echo $? (Checks if the last command succeeded.)
  • Background Processes: Use '&' to run a command in the background.
    • Example: ./script.sh &

Requirements 📋

To build and run the Minishell project, the following requirements must be met:

  • A Unix-based operating system (Linux, macOS) or a terminal emulator.
  • GCC compiler: The project should be compiled with the GNU C Compiler.
  • Bash or a similar shell: For testing and executing commands.
  • C libraries: Access to standard C libraries and system calls is required.
  • Make utility: A Makefile is used to build and manage the project.

Project Structure 📁

In addition to the main shell functionality, the project includes various helper functions and structures. Key components include:

  • Makefile: Used to compile and build the project.
  • minishell.h: Header file containing structure definitions and function prototypes.
  • minishell.c: Contains the core shell logic.
  • executor.c: Handles command execution and redirection operations.
  • parser.c: Parses user input and processes commands.
  • signals.c: Manages signal handling and control logic.
  • utils.c: Includes helper functions for string manipulation and memory management.

Contributing and Feedback 🤝

If you'd like to contribute or provide feedback:

  1. Fork the repository.
  2. Make your changes and submit a pull request.
  3. Open an issue on GitHub or join the discussion for suggestions and improvements.

License 📜

This project is licensed under the MIT License. You are free to use, modify, and distribute the code. For detailed license terms, please refer to the LICENSE file.


2025 This project was created by Derya ACAR.

About

This project builds a basic shell that executes commands, handles redirection, and supports pipes, teaching core shell concepts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors