print banner


The shell is still pretty bare-bones. It was written for an Operating System class as a first ("warm up") assignment, and was only required to take a command, fork and execute. I began working on a few improvements, and sort of liked the outcome. It has a few history commands, and the requirements. I was going to do piping (and as of this writing, may still). Features of the shell beyond the requirements are listed bellow.


The shell command history passed no parameters will list the history of the current run of the shell. History is not currently saved between sessions. The implementation I went with are special commands, because putting the terminal into raw mode or using curses were too much effort for a short assignment, and I wasn't sure what other libraries would be available where the lecturer would test the program (even though it was the same environment I wrote the shell in originally).

If history is passed a number n, then the command n-1 commands ago (not including history commands) is executed, this will be the same as the number before the command in the history list returned by history without passing an argument. so:

Don't Panic: a.out
Don't Panic: g++
Don't Panic: history
1 a.out
0 g++
Don't Panic: history 1

Will run a.out (and append to the history), if the number passed is larger than the history, it will execute the first program in the history.

"Bang" ! and "Bang, Bang" !!

The ! operation and the !! operation act as they do in bash/tcsh and other shells.

Minus-Minus -- and Plus-Plus ++

The minus minus was my answer to the up-key problem. Typing minus minus will move you to the previous command, so if you've run

Don't Panic: g++
Don't Panic: a.out
Don't Panic: --
Don't Panic: --

All you have to do is hit enter on the next prompt line to execute "g++" . If you -- more times than commands, it will run the first program in the history.

Following the above with: Don't Panic: ++

Will make the next bare ENTER execute a.out instruction instead of the "g++", the equivalent of the down arrow.

If another command is executed after a -- or a ++, the position is returned to the end and the next enter will give you a new prompt without any execution.

Batch files

The shell does not support scripting; however, it does support batch files (as long as you are in the directory as the file). The batch files need have readable permissions for the user the script is running under. If the specified file has a bad command in it -- or isn't a batch at all, the system will print an error, and stop executing any following commands. History commands are supported, which means a newline in a file could be interpreted as the acceptance of the minus-minus command -- "THIS IS NOT A BUG - IT'S A FEATURE."

In addition, the batch files require comments, so anything on a line after a pound "#" will be striped and ignored by the shell.

To Do

While more development on the project is unlikely, there are a number of features that I would still like to add at some point.

  • Scripting
  • Redirect
  • Pipes
  • Curses or raw support for up arrow