Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.17 KB

File metadata and controls

38 lines (26 loc) · 1.17 KB

🖥️ Java Shell – Command Line Interpreter

A simple, cross-platform shell (command-line interpreter) written in Java.
Supports command execution, cd navigation, input/output redirection (>, <), and single piping (|), all compatible with Windows CMD, PowerShell, and Git Bash.


📌 Project Overview

This project simulates a Unix-style shell using Java. It allows users to execute shell commands, manage directories, and handle redirection and pipes—teaching core Operating System concepts like:

  • 👶 Process Creation (fork() + exec() equivalent using ProcessBuilder)
  • 🔄 Input/Output Redirection
  • 🔧 Pipe Handling
  • 📂 Directory Management
  • 🧵 Process Synchronization (waitFor())

🚀 Features

✅ Custom prompt: mysh>
✅ Supports Windows commands like dir, type, echo, findstr
cd command implemented manually
✅ Handles:

  • Standard output redirection: echo Hello > out.txt
  • Standard input redirection (limited): somecommand < file.txt
  • Piping: type file.txt | findstr Hello

🧑‍💻 Usage

▶️ Running the Shell

javac MyShell.java CommandExecutor.java
java MyShell