Skip to content

ausperg/42_minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

128 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minishell (42 Project)

Overview

Minishell is a project from the 42 curriculum where I built a simple Unix shell from scratch. The main goal for me was to understand how a shell actually works behind the scenes by implementing core features myself, such as command execution, parsing user input, and handling basic system behavior.

Instead of relying on existing shell implementations, I worked directly with low-level system calls to manage processes, file descriptors, and signals.

The project is not intended to fully replicate Bash, but rather to include the essential, commonly used features of a shell and provide a user experience that feels similar to Bash.


Features

  • Execution of commands (ls, echo, cat, etc.)

  • Environment variable handling ($PATH, $HOME, etc.)

  • Built-in commands:

    • echo
    • cd
    • pwd
    • export
    • unset
    • env
    • exit
  • Pipes (|)

  • Redirections:

    • Input (<)
    • Output (>)
    • Append (>>)
    • Heredoc (<<)
  • Signal handling (Ctrl+C, Ctrl+D, Ctrl+\)

  • Basic error handling (syntax and execution)


What I learned

  • Process creation and control (fork, execve, wait)
  • File descriptors and I/O redirection
  • Parsing and tokenization
  • Memory management
  • Signal handling
  • General Unix system programming concepts

Build and run

Clone the repository:

git clone git@github.com:ausperg/minishell.git
cd minishell

Compile:

make

Run:

./minishell

Examples

$ echo Hello World
Hello World

$ export NAME=42
$ echo $NAME
42

$ cat < input.txt > output.txt

Tech stack

  • Language: C
  • System calls: fork, execve, pipe, dup2, waitpid
  • Standard C library and a custom libft

Notes

This project is part of the 42 curriculum and is intended for learning purposes. It focuses on understanding core Unix behavior rather than building a production-ready shell.

About

This project is about creating a simple bash shell with limitet functions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors