Skip to content
This repository was archived by the owner on May 5, 2026. It is now read-only.

vasco-castro/minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been created as part of the 42 curriculum by jsilveir, vsoares-.

minishell

Description

Minishell is a simplified shell implementation that replicates core functionalities of bash. The goal of this project is to understand how a shell works by building one from scratch, including process creation, file descriptor manipulation, signal handling, and command parsing.

Features

  • Interactive prompt with command history
  • Command execution via PATH lookup or absolute/relative paths
  • Built-in commands: echo, cd, pwd, export, unset, env, exit
  • Redirections: <, >, << (heredoc), >>
  • Pipes: connect multiple commands with |
  • Environment variable expansion: $VAR and $? for exit status
  • Quote handling: single quotes '...' and double quotes "..."
  • Signal handling: Ctrl+C, Ctrl+D, Ctrl+\

Instructions

Prerequisites

  • GCC compiler or compatible C compiler
  • GNU Make
  • readline library (libreadline-dev on Debian/Ubuntu)

Compilation

make

This will compile the project and generate the minishell executable.

Other Make targets

make clean    # Remove object files
make fclean   # Remove object files and executable
make re       # Rebuild the project

Execution

./minishell

Once running, you can use it like a regular shell:

minishell$ echo "Hello, World!"
Hello, World!
minishell$ ls -la | grep minishell
minishell$ cat < input.txt > output.txt
minishell$ export MY_VAR=42
minishell$ echo $MY_VAR
42
minishell$ exit

Resources

Documentation & References

AI Usage

AI assistance was used for:

  • Learning and understanding key concepts: Explaining how certain concepts of the shell syntaxt and behavior work
  • Code review and bug identification: Analyzing existing code to find potential issues, memory leaks, and norm violations
  • Documentation: Generating and formatting README documentation and project checklists
  • Refactoring suggestions: Identifying duplicate code and proposing structural improvements

All core implementation (parsing, execution, builtins, redirections, pipes, signals) was written manually by the project authors.

About

Minishell is a simplified shell implementation that replicates core functionalities of bash. The goal of this project is to understand how a shell works by building one from scratch, including process creation, file descriptor manipulation, signal handling, and command parsing.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors