BD-shell (a.k.a. bdsh) is a tiny Unix shell written in C. It’s a project required for the Operating System Course at my University.
It is written using a clean coding style, following xP coding standard philosophy.
Version 1.0 is the release that satisfies all the course requirements!
- Implements real Job Control
- Clear and understandable code, ideal for Academic (and personal) studies
- Makes use of various system calls, signals, signal handlers, user input handling, data structures implementation
- Free Software!
Cool Features NOT present (but may be in future)
- No command history present
- No command/filename auto completion
- No wildcars
- No command piping, just a single command can be launched at a time
- Put everything else here.
Requirements for 1.0.0
These are the requirements asked by the teaching professor. The complete project description page is located at http://www.inf.unibz.it/~david/os/project.html
The shell must be able to do the following:
- to read commands from standard input and execute them in a loop until a
built-in command exit is issued (we call these processes the foreground processes; there is always at most one of these at any particular time);
- be able to redirect the standard input and output of commands by prefixing them with built-in commands in file and out file;
- be able to terminate (involuntarily) the foreground process when user presses ^C and return back to the mini-shell;
- be able to interrupt the foreground process temporarily, when user presses ^Z, returning to the mini-shell;
- be able to execute any number of processes in background (i.e., in parallel with the foreground process), including in particular, the ability to start another process while a process has been temporarily suspended;
- inform the user when the background process finishes or is
waiting for an input from the terminal;
- be able to inform the user what commands are executing in the background by issuing the built-in command jobs, this should include information about the state of the process (i.e., suspended, background, waiting for input, etc.) and about what file(s) is the background process using for standard input and output);
- be able to terminate involuntarily a background processes by issuing the built-in command kill job-number.
- to be able to resume a process or to make a background process into the foreground process (i.e., the one that currently interacts with the terminal) by issuing the fg job-number command.
- 2008-09-14 – bd-shell-v1.0.0.tar.
- fixed synchronization bug in putJobBackground() that made not notify background processes requesting input (in some situations)
- Lots of! I consider bdsh-1.0.0 stable because it covers ALL requirements of the course and does them whell on various Unix systems. So it works, but commands like “in non_existent_file cat” won’t work and will crash it!
What will be next?
- I don’t know. I may consider a 1.0.1 release to fix future bugs. I may also think to add cool features to make the shell complete. I hope I will have the time for it. You can also do it by yourself and send me the code
Due to a server crash, the old releases are unavailable.
BD-shell is released under The Gnu GPL version 3! This is different from the license of the contents of the blog
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>>.