Shell
Simple implementation of a Linux shell written in C language. I made this project to learn internals of linux shells and improve my skills in C language.
Usage
- Clone this directory and
cd
into it. - Run the command
make
. - Run
./shell
. - Run any command in the shell.
- In order to exit, run
exit
.
Features
Commands
cd [DIR]
- Changes directory to directory specified
- Throws an error when directory does not exist
cp [FILE1] [FILE2]
- Copies FILE1 to FILE2, creates new file when FILE2 doesn't exist
- Throws an error when FILE1 doesn't exist
help
- Shows description of each command
history
&clearhis
- Lists history of used commands
clearhis
clears history of used commands
! [NUM]
&!!
- Executes command number [NUM] in history file
!!
executes last used command
myls [PATH]
- Implementaion of the ls command
- If no arguments are specified, it lists files and directories in current directory
mkf [FILE]
&rmf [FILE]
- Creates specified FILE if it doesn't already exist
- Removes specified FILE, throws an error when FILE doesn't exist
rabbit [FILE]
- Implementation of the cat command
- Prints file on the standard output
setenv [name] [value]
&unsetenv [name]
- Creates an enviornmental variable
var
if it doesn't already exist and assigns it the value given unset [name]
destroys that environmental variable
- Creates an enviornmental variable
time
- Shows current time
Other
I/O redirections
- Handles
<
,>
,>>
operators wherever they are in the command
- Handles
Pipes
- Handles
|
operator - Multiple piping is allowed
- Handles
Note
This project is still in development. I plan to add new commands and features.