Skip to content

MyShell is a lightweight, minimalistic command-line shell implemented in C, designed to provide a simple and efficient interface for executing Unix-like commands on Windows platforms.

Notifications You must be signed in to change notification settings

Aashish257/shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐚 MyShell

A lightweight, minimalistic command-line shell implemented in C, designed to execute Unix-like commands on Windows and Unix-like platforms.
Supports essential shell functionalities including built-in commands, background jobs, piping, and I/O redirection.

License Platform Language


🚀 Features

Built-in commands: cd, pwd, exit, history, and on Windows: jobs, kill, fg
Background execution using &
Command piping (|) to chain commands
Input & output redirection (<, >)
Basic job control (Windows only)
Persistent command history (history/command_history.txt)
Cross-platform support, primarily Windows


📂 Table of Contents


🗂 Source Structure

File Description
src/main.c Main program & user input loop
src/utils.c Helper utility functions
src/builtins.c Built-in shell commands implementation
src/executor.c Command execution & process management
src/jobs.c Background job control (Windows only)
src/history.c Command history management
src/parser.c Placeholder for advanced parsing
include/utils.h Utility function declarations

🛠 Build Instructions

Make sure you have GCC installed.

gcc -o myshell src/main.c src/utils.c src/builtins.c src/executor.c src/jobs.c src/history.c
  • ✅ Recommended to compile & run on Windows for full job control functionality.
  • On Unix-like systems, it works for general commands but without jobs, fg, and kill.

💻 Usage

Run your shell executable:

./myshell

⚙ Examples

  • Basic commands

    pwd
    cd <directory>
    dir
    exit
    history
  • Run in background

    notepad &
  • Piping

    dir | find "txt"
  • Redirection

    dir > output.txt
    type < input.txt
  • Job control (Windows only)

    jobs
    kill <job_id>
    fg <job_id>

📝 Notes

  • On Windows, pwd might not be recognized — use echo %cd%.
  • jobs, kill, fg only work on Windows.
  • Command history is saved at history/command_history.txt.
  • Parser is currently a placeholder; does not support complex syntax or scripting.
  • Intended primarily for educational purposes & simple shell operations.


📧 Contact

For queries or suggestions, feel free to reach out or open an issue.

About

MyShell is a lightweight, minimalistic command-line shell implemented in C, designed to provide a simple and efficient interface for executing Unix-like commands on Windows platforms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published