Skip to content

Sachin-A/sh.c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sh.c

A simple shell written in C!
Build exclusively for educative purposes and it demonstrates just the basics of how a shell works

Installation

You would need gyp/ninja to build and run this project

Following commands assume installation outside sh.c

So first install gyp like this:

$ git clone https://chromium.googlesource.com/external/gyp.git && cd gyp  
$ sudo python setup.py install

Ninja is a small build system that is designed to be ultra fast

Get ninja installed like this:

$ git clone https://github.com/ninja-build/ninja.git && cd ninja  
$ cd ninja  
$ ./configure.py --bootstrap  
$ cp ninja /usr/local/bin/

Now build the shell

$ gyp sh.gyp --depth=. -f ninja  
$ ninja -v -C out/Default -f build.ninja  

It's all set to be run. Run it like:

$ ./out/Default/shell

Features

  • Built-ins: history, history bg
  • Supports system commands

To do

  • Basic shell architecture (REPL through unix style fork/exec)
  • Directory prompt
  • Shell built-in : history (queue with a buffer limit)
  • Execute background processes through &
  • Built-ins: cd, exit, help
  • Status of background processes through monitoring child continuously
  • Ability to pass process to foreground/background through fg/bg
  • Remove output of background processes from terminal completely

About

A simple shell written in C!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published