Skip to content

feliposz/shell-job-control-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Shell with Job Control

This is a simple unix shell with job control capabilities.

It was implemented as an exercise for better understanding the handling of processes and signals in unix/linux and the underlying mechanisms of job control.

The initial code is part of the Shell Lab and follows Chapter 8: Exceptional Control Flow of the book Computer Systems's - A Programmers Perspective.

The main implementation is on file tsh.c. The other files are provided from the handouts for the lab. If you want to try it yourself, get it here.

Features

  • Built-in commands: quit, jobs, fg, bg
  • Run external programs (absolute path only)
  • Can start processes on the background with &
  • jobs lists status of jobs
  • fg and bg accept process id (e.g. fg 12345) or job id (e.g. bg %2)
  • Correctly handles Ctrl+C (interrupt), Ctrl+Z (stop) and all signaling on child processes and process groups

Requirements

  • Developed/tested on Linux
  • GCC
  • Make
  • Perl (only to run the sdriver.pl test script)

Building and running

$ cd src
$ make clean
$ make                        # compile the shell and auxiliary programs
$ make testXX                 # run test number XX
$ ./tsh                       # run the shell interactively
$ ./tshref                    # run the REFERENCE shell for comparison

Check src/README for more options.

Other projects

For a shell implementation with a more complete set of features check: