Skip to content

MickaelDP/MyShelf-A-custom-Unix-Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyShelf - Custom Unix Shell

Advanced Systems Programming

Paris 8 University (Bachelor Legacy) 2019 Original Development

2026 Refactored for Translation.


📌 Overview

MyShelf is a functional Unix-like shell developed in C. It was created as the final project for the Operating Systems course at Paris 8 University. It implements the core mechanics of a command-line interpreter, focusing on process lifecycle management, environment handling, and I/O stream manipulation.

Starting from a foundational academic version, this 2026 edition focuses on code translation.

🚀 Implemented Features

📂 Built-in Commands

  • cd [path]: Manual implementation of directory navigation.
    - Supports relative and absolute paths with call of chdir().
    - Handles special symbols: . (current), .. (parent), and ~ (home).
    - Includes a security check to prevent navigating above the /home directory.
  • exit: Gracefully terminates the shell session.

⚙️ Process Management

  • Execution: Launches external binaries using fork(), execv(), and wait().
  • Background Tasks (&): Supports non-blocking process execution.
    - Displays the Process ID (PID) upon launch.
    - Monitors child processes to provide termination notifications and prevent zombie processes (using waitpid logic).
  • PATH Resolution: Automatically searches for executables within the directories defined in the system's PATH environment variable.

⚙️ I/O & IPC

  • Redirections: Implements standard input (<) and output (>) redirection to files using dup2 and fcntl logic.
  • Pipes (|): Supports sequential command chaining where the output of one process is piped as the input to the next.

✨ Bonus Feature

  • File Auto-completion: Advanced implementation allowing users to complete filenames using the Tab key, integrated within the terminal read logic.

🏗 Architecture & Internal Logic

The shell follows a modular REPL (Read-Eval-Print Loop) design:

  • Lexer/Parser: A custom decouper function tokenizes the input string based on delimiters (spaces, tabs, newlines)
  • String Manipulation: Specific internal functions like cutstr and selectstr are used for complex parsing of command arguments.
  • System Headers: Uses a dedicated sys.h to manage critical includes like unistd.h, sys/wait.h, and sys/stat.h.
  • Executor: Handles the logic of forking, searching the PATH, and executing system calls.
  • Process Monitor: A core routine that monitors background tasks (&) and ensures terminated child processes are properly reaped to prevent system resource exhaustion (zombie processes).

🛠 2026 Refactoring

  • Memory Management: Fixed specific memory leaks (e.g., in the stat buffer and string duplications) to ensure stability.
  • Language Translation: All internal code comments and user-facing messages have been translated from French to English.

📦 Installation & Usage

Bash

Clone the repository

git clone https://github.com/your-repo/myshelf.git

cd myshelf

Compile using the provided Makefile

 make

Launch MyShelf

 ./myshelf

About

MyShelf is a functional Unix-like shell that demonstrates core operating system concepts and low-level systems programming. Originally developed in 2019 and refactored in 2026

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors