Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

mysh — A Unix Shell in C

A POSIX-compliant Unix shell built from scratch in C.

Features

  • Run any system command (ls, cat, echo, pwd...)
  • Pipes (ls | grep .c)
  • Output redirection (echo hello > file.txt)
  • Input redirection (cat < file.txt)
  • Built-in commands: cd, exit, help
  • Prompt shows current working directory

Build & Run

gcc main.c -o mysh ./mysh

Syscalls Used

Syscall Purpose
fork() create child process
execvp() replace child with command
waitpid() wait for child to finish
pipe() connect two processes
dup2() redirect input/output
chdir() change directory
getcwd() get current directory

What I Learned

  • How Unix processes work
  • How every shell on earth works under the hood
  • File descriptors and I/O redirection
  • Inter-process communication with pipes

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages