Skip to content

Terminal shell in C to understand exceptional control flow.

Notifications You must be signed in to change notification settings

chettriyuvraj/shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Shell

Terminal shell in C to understand exceptional control flow.

This shell was created to apply concepts learnt in Chapter 8 of CS: APP

What works and what is left:

  • It has a really cute logo 🔥
  • Executes commands by spawning child processes: try sleep 30 in this shell and quickly ps -j -h | grep sleep in bash to see the child process you have created.
  • Demonstrates the concept of signal handling: try sleep 30 and ctrl + c to send a SIGINT which kills the child process, you can check using the ps command previously explained.
  • Operator handling: implements the && and || operators as they work in bash.
  • Implements the notion of a foreground process with the & operator: try sleep 30 & sleep 40 & sleep 50, then ctrl + c which sends a signal only to terminate sleep 50, since the rest are background processes.

TODO:

  • builtins, implemented the alias builtin which turned into a big ball of mud, so currently only exit works.
  • job control: things such as the bg, fg and jobs command, which will be the end of this project!

Usage

  • compile: gcc shell.c
  • run binary: ./a.out

Output

A pretty wack shell

image

About

Terminal shell in C to understand exceptional control flow.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages