Skip to content

allancrabelo/Minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

145 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42

C Bash Script Linux Git MarkdownJira

minishell banner

Minishell - 42 School

📖 Description

Minishell is a project from 42 School focused on implementing a simplified shell inspired by Bash. The goal is to gain a deep understanding of how Unix shells work, including command parsing, process execution, input/output redirection, and variable expansion.

This project helps develop skills in C programming, Unix systems, processes and signals, as well as reinforcing concepts in data structures and string manipulation.

🛠 Implemented Features

The Minishell includes:

Execution of built-in commands:

  • cd – change the current directory.
  • echo – display messages in the standard output.
  • pwd – print the current directory.
  • export – set environment variables.
  • unset – remove environment variables.
  • env – list environment variables.
  • exit – exit the shell.
  • Execution of external commands (like ls, cat, etc.).
  • Pipelines (|) to chain commands.

Redirection:

  • > and >> (output to file)
  • < (input from file)
  • Variable expansion ($VAR).
  • Signal handling (CTRL+C, CTRL+) in a controlled way.
  • Command parsing with single and double quotes.

⚙️ Technologies

  • Language: C
  • System: Unix/Linux
  • Compiler: cc
  • Standard C libraries (unistd.h, stdlib.h, stdio.h, etc.)

📝 Project Structure

minishell/
│
├── src/           # Minishell source code
├── include/       # Headers and structs
├── Makefile       # Compilation rules
├── README.md      # Documentation
└── tests/         # Scripts to test features

💻 How to Compile

To compile the project, use the included Makefile:

make

This will generate the executable:

./minishell

To clean compiled files:

make clean
make fclean   # Removes the executable as well

🚀 Usage

Once the shell starts, you can type commands like in Bash:

$ echo "Hello, Minishell!"
Hello, Minishell!
$ pwd
/home/user
$ ls -l | grep ".c"
main.c
utils.c

📚 References

Unix/Linux Man Pages Bash documentation for reference Material provided by 42 School

👨‍💻 Author

Allan Rabelo & Miguel Queiros

About

A recreation of Bash in C. Features command execution, custom parser, pipes, redirections, heredocs, environment variable handling, built-in commands (cd, echo, export, etc.), and full signal management (e.g., Ctrl+C). Built as a team project with focus on performance, modularity, memory safety, and clean architecture.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors