Skip to content

A command-line interpreter that can execute basic shell commands and provide a shell-like environment.

Notifications You must be signed in to change notification settings

hanmpark/minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minishell

A small shell implementation in C, recreating key features of Bash 3.2.


Repository created at Repository code size Mostly used language

📖 Description

The minishell project recreates a simplified version of Bash.
It allows executing commands, handling redirections and pipes, managing environment variables, and implementing built-in commands.
This project strengthens understanding of:

  • "Parsing and Abstract Syntax Trees (AST)"
  • "Process creation (fork, execve)"
  • "Signals (ctrl-C, ctrl-D, ctrl-\)"
  • "Redirections, heredocs, and pipes"

🛠️ Features

✅ Mandatory

  • Display a prompt and wait for commands
  • History functionality
  • Locate and launch executables (builtins, $PATH, relative/absolute paths)
  • Manage single/double quotes
  • Implement redirections (<, >, <<, >>)
  • Implement pipes (|)
  • Manage environment variables ($) and $?
  • Proper signal handling (ctrl-C, ctrl-D, ctrl-\)

🔥 Bonus

  • Logical operators: && and ||
  • Parentheses for priorities (no subshells)
  • Wildcard * (current directory only)

Builtins Implemented

  • echo with -n
  • cd (relative/absolute paths)
  • pwd
  • export
  • unset
  • env
  • exit

❌ Limitations

"No unclosed quotation marks" "No unsupported characters (e.g., \ backslash, ; semicolon)" "No features outside the subject specification"

🧩 Global Structure (Abstract Syntax Tree)

minishell global structure

📦 Installation

Clone the repository and compile:

git clone https://github.com/hanmpark/minishell.git
cd minishell
make

🚀 Usage

Run the shell:

./minishell

To debug tokenization and AST generation:

./minishell debug

Example

minishell$ echo 1 | cat -e || (echo 2 && echo 3) || echo 4

👤 Authors

About

A command-line interpreter that can execute basic shell commands and provide a shell-like environment.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •