Skip to content

AT95BL/At95-Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

🐚 At95-Shell: Minimalist Linux Command Interpreter

A lightweight, functional Unix shell written in C. This project demonstrates core systems programming concepts, including process lifecycle management, inter-process communication (IPC), and low-level file descriptor manipulation.

🛠️ Core Features

  • Process Execution: Supports running any external Linux binary by leveraging fork() and execvp().
  • I/O Redirection: Implements output redirection (>) by manipulating file descriptors with dup2().
  • Command Piping: Supports inter-process communication via pipes (|), allowing the output of one process to serve as the input for another.
  • Built-in Commands: Native support for cd (Change Directory), help, and exit to manage the shell environment.
  • Robust Error Handling: Custom error reporting using perror for system call failures.

🏗️ Technical Architecture

The shell operates on a REPL (Read-Eval-Print Loop) architecture:

  1. Tokenization: User input is parsed into a null-terminated array of strings using strtok.
  2. Process Management: For external commands, the shell creates a child process. The parent process synchronizes using wait() or waitpid().
  3. Pipe Implementation: When a pipe is detected, the shell initializes a kernel buffer via pipe(), forks two concurrent child processes, and reassigns their standard streams.

🚀 Getting Started

Prerequisites

  • GCC Compiler
  • Linux Environment (tested on Linux Mint/Ubuntu)

Installation & Execution

  1. Clone the repository:

    git clone [https://github.com/AT95BL/At95-Shell.git](https://github.com/AT95BL/At95-Shell.git)
    
  2. Compile the source code: gcc shell.c -o shell

  3. Run the shell: ./shell

About

A Minimalist C Interpreter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages