My implementation of linux shell in C, refer to the guide for detailed description of functions and usage.
- Handles variable assignment and expansion
- Piping of commands (
|
) - Only Output redirection (
>
and>>
) is supported for now. - Catches SIGINT and prevents interruption.
- Inbuild commands are
- cd Change Current Directory
- showvar Print shell variables
- showenv Print environment varaibles
- export Export variable to environment scope
- unset Remove varaible from environment scope
- pushd Add directory node to top od directory stack
- popd Remove directory node from stack
- dirs Print directory stack
- source Execute commands from script file
- exit Exit the shell
To compile you need the readline package , run the following command in terminal to install the package, ignore if already installed.
sudo apt-get install libreadline8 libreadline-dev
The readline library provides line auto-completion and suggestion with history functionality.
To compile using gcc and execute run the following command.
make all; ./shell
Exit the shell by typing exit or quit .