/nush

Simple UNIX shell written in C

Primary LanguageC

nush

Simple UNIX shell written in C

About

This shell was written as a homework assignment to cover the use of fork(), exec(), and wait(). It first tokenizes an input line then uses a small data structure I made to parse it and begin execution.

This shell can handle the following operators:

  • Redirect output ">"
  • Redirect input "<"
  • Background "&"
  • Boolean and "&&"
  • Boolean or "||"
  • Pipe "|"
  • Semicolon ";"

Fair warning: it might not handle all of these perfectly, i.e. multiple in conjunction. However it does pass all tests included (at least on my Debian VM), look to those for examples of what works.

Usage

This was compiled using GCC, so it expects that to work. To compile the files, simply run the following command (if make is installed)

make

To run the tests, use the following command:

make test

To clean all files compiled and generated by tests, run the following:

make clean

To begin running the shell, simple execute a make command then run ./nush. Commands can also be passed into the shell with a file by using the following command:

./nush [path-to-file]

This will read it line by line and execute the commands.