- Linux OS
- GCC Compiler
To run A-Shell,
- Open terminal in the root directory and run
make
- run
./shell
to start the shell.
- Basic commands
cd
,pwd
,echo
,ls
,history
,discover
are supported
- Input handled for all commands in
main.c
,input.c
andexecute.c
- Displaying of prompt handled in
prompt.c
,main.c
- File redirection supported using
>
,>>
and<
tokens. - Autocomplete functionality, detects and autocompletes the name of currently typed file or directory.
- Signal handling :
CTRL + Z
sends the currently running foreground job to background and changes its state fromrunning
tostopped
. Has no effect if no foreground job running.CTRL + C
interrupts the currently running foreground job by sending theSIGINT
signal. Has no effect if there is no foreground job running.CTRL + D
logs the user out of the shell without having any effect on the actual terminal.
- Piping functionality for commands.
- Implemented in
cd.c
- Print the arguments passed to echo in a space seperated manner
- Implemented in
execute.c
- Print the present working directory
- Implemented in
execute.c
- Print the contents of the specified directories (current directory if argument list empty)
- Supports
-l
and-a
flags. - Implemented in
ls.c
- Shell executes system in either background or foreground
- Commands invoked with
&
run in the background while all other commands run in the foreground. - Main functionality in
bg_handler.c
with supplementary code inexecute.c
,input.c
andprocess_list.c
- Prints the process related info of your shell program
- Implemented in
pinfo.c
- Searches for the target file/directory in the directory given as argument (current directory by default) according to the given flags. (-d searches for directories only while -f searches for files only)
- Implemented in
discover.c
Displays a maximum of latest 10 commands input to the shell accross all instances of the shell created on the system. Following are the basic implementation details:
- Main implementation in
history.c
init_shell()
is called in main to ensure existence of the file/tmp/A-Shell_history.txt
whenever a shell instance is created- Updation of
/tmp/A-Shell_history.txt
on every input is handled ininput.c
Displays a list of currently existing background processes with their index, status (running or stopped) and name sorted in alphabetical order.
- Main implementation in
jobs.c
Sends the specified signal to the specified job index as shown in jobs
.
- Main implementation in
jobs.c
Brings the specified job index, a currently background job, to the foreground and changes its state to running.
- Main implementation in
jobs.c
Changes the state of a stopped background process to running in the background. It does nothing if the background job is already running.
- Main implementation in
jobs.c