This is an attempt to immitate the Linux terminal. It supports most semicolon separated commands, including builtin commands like cd, ls, echo, pwd. Background and Foreground processes are also handled.
-
pwd : prints present working directory.
-
cd : changes directory as per the flags given.
cd cd . cd .. cd ~ cd <directory>
-
ls : lists contents of a particular directory based on the flags given. All flags are supported, ordering doesn't matter.
ls ls -a ls -l ls -la ls -al ls <directory>
-
echo : prints a message on the terminal.
echo <"Hello World">
-
pinfo : lists details of a given process id, of the shell in case process id is not specified.
pinfo <pid> pinfo
-
setenv : setting an environment variable
setenv a 7
-
unsetenv : unsetting an environment variable
unsetenv a
-
jobs : prints a list of all jobs executed by the shell
jobs
-
kjob : send specified signal to the specified job
kjob 2 9
-
fg : brings a background process to foreground
fg 1
-
bg : pushes a foreground process to the background
bg 2
-
overkill : kills all running processes in the shell
overkill
-
Foreground processes require the shell to halt for the child process to complete before the shell resumes control.
vim gedit emacs
-
Background processes are specifies with a '&' at the end as a flag. These processes run in the background allowing the shell to execute processes simultaneously.
emacs & evince & gedit &
- The shell supports redirection using <, >, >>
- The shell supports pipping
- Input- Output redirection is supported.
- CTRL + Z and CTRL + C are accepted
In order to run the shell on your local device use the following command :
make
./a.out
The shell considers the home directory to be the directory in which the executable ./a.out resides.
To exit the shell, use the following command :
quit
-
main.c Contains the main driver code for the shell.
-
execute.c Contains the code to execute each command.
-
pwd.c Contains the function to execute builtin pwd command.
-
ls.c Contains the function to execute builtin ls command, and support all flags.
-
cd.c Contains the function to execute builtin cd command.
-
echo.c Contains the function to execute builtin echo command.
-
pinfo.c Contains the function to execute builtin pinfo command.
-
history2.c Contains the function to display history.
-
redirection.c Contains the code for basic redirection.
-
pipeline.c Contains the code for pipelined commands.
-
jobs.c Contains the function to execute builtin jobs command.
-
kjob.c Contains the function to execute builtin kjob command.
-
overkill.c Contains the function to execute builtin overkill command.
-
setenv.c Contains the function to execute builtin setenv command.
-
unsetenv.c Contains the function to execute builtin unsetenv command.
-
fg.c Contains the function to execute builtin fg command.
-
bg.c Contains the function to execute builtin bg command.
-
nightswatch.c Contains the function to execute builtin nightswatch command. Implementation in progress.