Skip to content

Baranidharanv06/myshell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

myshell ๐Ÿš

A Unix shell built from scratch in C, running on macOS.

Features

  • Command execution โ€” run any system command (ls, pwd, echo, etc.)
  • cd & exit โ€” built-in navigation and exit
  • Pipes โ€” chain commands together (ls | grep .c)
  • Output redirection โ€” save output to files (ls > output.txt)
  • Colored prompt โ€” green and blue styled prompt
  • Error handling โ€” friendly messages for unknown commands

Build & Run

git clone https://github.com/Baranidharanv06/myshell.git
cd myshell
gcc shell.c -o myshell -L/opt/homebrew/opt/readline/lib -I/opt/homebrew/opt/readline/include -lreadline
./myshell

Usage Examples

myshell> ls
myshell> pwd
myshell> echo hello world
myshell> cd ..
myshell> ls | grep .c
myshell> ls > output.txt
myshell> cat output.txt
myshell> exit

What I learned

  • How a Unix shell works under the hood
  • Process creation using fork() and execvp()
  • Inter-process communication using pipe()
  • File descriptors and I/O redirection with dup2()
  • Parsing and tokenizing user input in C

Tech Stack

  • Language: C
  • Platform: macOS (Apple Silicon)
  • Library: readline

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages