- GCC compiler
- LINUX OS (Ubuntu)
- To execute the program:
$ make main
$ ./mainA shell prompt of the following form will appear
<username@system_name:curr_dir>- Code is written in modular fashion.
- ';' separated commands are handled.
- Tokenisation is handled in main.c.
- All the headers are included in header.c
The cd commands work assuming the home directory to be the directory from which the shell is invoked.
- This is written in cd.c
-
cd : Directs to the home directory.
-
cd ~ : Directs to the home directory.
-
cd . : Stays in the same directory.
-
cd .. : Directs to the previous directory.
-
cd - : Directs to the previous cd command. It prints the address from the systems shell.
- All other cd commands are handled.
- This is written in pwd.c
- Absolute path from our system's home is printed.
- This is written in echo.c
- The text after echo will be printed.
- Spaces and tabs are handled.
- This is written in ls.c
- All the given ls commands are handled.
- Specific colour coding is used to differentiate between file names, directory names and executables.
- File names are printed in white color.
- Directories are printed in Blue color.
- Executables are printed in green color.
- Both the background and foreground processes are handled in fbp.c
- The commands which are followed by '&' are done in background.
- After the process is done in the background, it's name along with pid is printed after the execution of the next command.
- If the process is done in foreground .. time taken for it will be printed in the shell.
- This is written in pinfo.c
- pinfo prints the process-related info of your shell program.
- "pinfo pid" prints the process info of the given pid.
- '+' is printed in the process status indicating it is a foreground process.
- Both the background and foreground processes are handled in fbp.c
- The commands which are followed by '&' are done in background.
- If the background process exits then the shell displays the appropriate message to the user.
- This is written in discover.c
- This command searches for files in the directory hierarchy.
- This is written in history.c
- History command prints the previous 10 commands given in the terminal.
- The command is printed only once if it is the exactly same as the previously entered command of it.
- Specification is handled in io_redirect.c.
- I/O redirection is handled as '<','>','>>'.
- Using execvp command for the commands which are not done in assignment 2.
- It is also handled in main.c
- Specification is handled in pipe.c.
- A pipe, identified by |, redirects the output of the command on the left as input to the command on the right.
- Piping of multiple commands are handled.
- Using execvp command for the commands which are not done in assignment 2.
- It is also handled in main.c
- Specification is handled in pipe.c.
- Input/output redirection occuring with command pipelines is handled.
- Specification is handled in jobs.c.
- jobs - prints a list of all currently running background processes spawned by the shell in alphabetical order of the command name, along with their job number,process ID and their state, which can either be running or stopped.
- Flags implemented for the command are -r and -s.
- This specification is handled in sig.c
- Takes the job number of a running job and sends the signal corresponding to the signal number to that process.
- It will throw error if invalid job number is given.
- This specification is handled in user_cmnd.c
- This brings the running or stopped background job to the foreground and changes its state to running.
- It will throw error if invalid job number is given.
- This specification is handled in user_cmnd.c
- It changes the state of a stopped background job to ruuning, which runs in the background.
- It does nothing if the job is already running in the background.
- It will throw error if invalid job number is given.
- Handled in main.c
- It pushes any currently running foreground job into the background and changes its state from running to stopped.
- It interrupts any cuurently running foreground job.
- No effect if there is no foreground process running.
- It logs out of the shell.