Made for an assignment/s for OS&N Course Monsoon 2022-23.
Completely coded in C.
make/make bbsh(For building the executable file)make clean(For cleaning the built files)
BB-SHELL is a very advanced noob shell, which can do some work, but very limited. 😅
It has some of the following features as of now:- (More may not come later)
- Colourful shell display with username/hostname and current directory.
- Can run some built-in commands such as
cd,echo,pwd,ls(With -a and -l flags). - Other Commands -
pinfo(≈ ps),discover(≈ find with -d and -f flags) - Stores
historyof upto 20, for all the sessions. - Error Handling
- Can run both
backgroundqandforegroundprocesses. (For any other shell commands) - Multiple Command Execution in a single line using
;. exitis used to exit the shell.- I/O Redirection using pipes and < & >/>>.
- Autocomplete file names.
- Signal Handling (Ctrl-C, Ctrl-Z, Ctrl-D)
-
Usage: cd <path_to_directory>Supports the following wildcards:
~: path to shell's home directory-: path to previous directory.: path to current directory..: path to parent directory
-
Usage: pwd -
Usage: echo <string> -
Usage: ls <path_to_directory_1> <path_to_directory_2> ...Flags:-
-a: do not ignore entries starting with .-l: use a long listing format
Supports all the wildcards as
cd. -
Usage: pinfo <pid>Gives the following info:
- Process ID
- Process Status
- Virtual Memory
- Path to Executable
-
Usage: discover <target_dir> "<file_name>"Flags:-
-d: searches for all directories-f: searches for all files
All arguments/flags are optional to use.
-
Usage: exitAlaias for
exit->quit -
Usage: historyPrints the last
10commands in the history. -
Usage: jobs- Prints a list of all currently running background processes spawned by the shell in alphabetical order of the command names.
-
Usage: sig <job id> <signal number>- Sends a signal to the job with given id (Running in background)
-
Usage: fg <job id>- Brings the process into foreground and set it running.
-
Usage: bg <job id>- Sets the given id background process in running state.
-
- Runs the command in the foreground.
- If
&is added at the end, will run the command in background.
main.c-> Containing the parent code to run the shell. Just mainly calling different functions.libraries.h-> Containing all the imports and in general definitions.input.candinput.h-> Containing the functions to take input, process it and do tasks based on that. Also, handles the I/O Redirection processes.raw_input.c-> Containing the functions to take raw input, also handling the autocomplete functionality.print.candprint.h-> Containing the code to print prompt, errors, etc.signals.candsignals.h-> Containing the functions to handle different basic signals and process them accordingly.path.candpath.h-> Containing the functions to process different directories and paths.history.candhistory.h-> Reading, Processing and Writing History. If want to change the path of the history file, you can use thishistory.hfile.discovery.canddiscovery.h-> Handles the code fordiscoverycommand and its variants.jobpool.candjobpool.h-> Manages the current running processes in the shell, along with doing book-keeping for the background processes.helpers.candhelpers.h-> Some basic functions for using at different places.commands1.c,commands2.candcommands.h-> Imp. functions for different commands and all of their implementations.