Skip to content
Sammm2006Public

About

A small Unix shell in C, written to find out how a shell actually works.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spsh

A small Unix shell in C, written to find out how a shell actually works.

What's here

  • spsh.c - main loop, reading input, running programs with fork + exec
  • buildin.c - built-ins (cd, pwd, echo, exit) and <, >, >> redirection
  • util.c - prompt and banner

Build with make, run with ./spsh.

Status: done (hope to work on limitations in the future)

The goal was to understand how a shell works, and it got there: it runs programs, has a few built-ins and handles redirection.

Limitations

These aren't supported:

  • Pipes (ls | grep foo)
  • Ctrl+C handling (right now it kills the shell, not just the running command)
  • Quotes and escapes (echo "hello world", cd "My Folder")
  • Redirection without spaces (ls>out.txt)
  • Environment variables: $HOME, $?, ~, plus export and unset
  • Exit codes: $? and exit N
  • Chaining with &&, || and ;
  • Background jobs with &, plus jobs, fg and bg
  • Command history and arrow-key line editing

About

A small Unix shell in C, written to find out how a shell actually works.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages