Skip to content

manugonz42/minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐚 Minishell

Bash-like shell in C

C 42 Project Shell


🎯 About

Minishell is a 42 school project that implements a simplified bash-like shell. This project teaches fundamental concepts of:

  • Process management — Creating and managing child processes
  • File descriptors — Input/output redirection
  • Pipes — Connecting commands together
  • Environment variables — Managing shell environment
  • Signal handling — Responding to user signals

✨ Features

  • 🔧 Built-in Commandsecho, cd, pwd, export, exit, unset
  • Command Execution — External commands via execve
  • 📥 Input Redirection< operator
  • 📤 Output Redirection> and >> operators
  • 🔗 Pipes| operator for command chaining
  • 🌍 Environment Variables$VAR expansion
  • 📢 Signal HandlingCtrl+C, Ctrl+D, Ctrl+\

🛠 Requirements

  • C compiler (gcc or clang)
  • Make
  • Unix-like system (Linux or macOS)

▶️ Usage

  1. Clone the repository:

    git clone https://github.com/manugonz42/minishell.git
    cd minishell
  2. Compile the project:

    make
  3. Run the shell:

    ./minishell

📚 Supported Commands

Built-ins

Command Description
echo Display text
cd Change directory
pwd Print working directory
export Set environment variable
unset Remove environment variable
env Print environment
exit Exit the shell

External Commands

Any command available in your $PATH can be executed.


🔧 Examples

# Basic commands
ls -la
cat file.txt

# Redirections
echo "Hello" > file.txt
cat < file.txt >> output.txt

# Pipes
ls -la | grep ".txt"
cat file.txt | wc -l

# Environment variables
export MY_VAR="Hello"
echo $MY_VAR

📚 Resources


🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details.


📄 License

This project is part of 42 School curriculum.


📫 Contact

Manuel González - LinkedIn - [email protected]

Project Link: https://github.com/manugonz42/minishell

About

A "bash-like" shell developed in C.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages