- GCC compiler
- Linux OS (preferably Ubuntu)
From the root directory of project, run make followed by ./shell
-
shell.c- Run Shell Loop
- Extract Arguments from command
- Bind functions from different files together
-
history.c- Adds command to history
- Stores maximum 20 commands
- Outputs latest 10 commands
-
echo.c- Prints user input after removing excess spaces/tabs
-
cd.c- Navigate to different directories
-
ls.c- Prints all files/sub-directories in a location
- Flags implemented:
aandl - Multiple directories supported
-
pinfo.c- Prints info about process with given PID (current process if none is given)
-
history.c- Prints last n commands, where n is the number given or 10.
-
discover.c- The command searches for files in a directory hierarchy.
- Exiting from the Shell
Ctrl+DorCtrl+Con an empty prompt.
-
I submitted two files. One of them has a modularised code and the other one is not.
-
Reasonable assumptions are made for things like length of current path, number of commands, command length, etc. The shell will work perfectly for all "day to day work".
-
userandhostnamewill be constant throughout the life of current shell instance. -
echowill treat everything as normal character. -
File and directory names shouldn't contain spaces or special characters. (Some commands may work even without this.)
-
pinfomay break on systems not running Ubuntu. This command uses/procfiles which may not be same for other OS.quitcommand. -
Every user input will be stored as it is in history, given it is not same as the last input and contains at least one character other than space or tab.
-
Prompt will display only terminated normally or terminated abnormally when a background process ends.
-
Prompt will check exist status of background processes only after user inputs a command (possibly empty). The same happens in actual Bash shell.
-
Any error while running a command will result in aborting the command after printing an error message.
-
&(used for running process in background) can come anywhere in command. -
A hidden file (
.history) is used to store history in a readable format. Any changes explicitly done in this file may result in unexpected output ofhistorycommand.