Skip to content

EliasEly/EEShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHELL

Author : Elias El Yandouzi

Date : October 2020

State : Can be improved

About the shell

This shell is written in C and can execute builtin command and program referenced in the PATH variable.

Build and Run

$> make
$> ./shell

To leave the process, a EOF signal must be send (^D does the job for instance).

Builtin Command

Mainly through system call in C. Nothing very tricky. No fork here.

NB: (OLDPWD, PWD) and cd are independant.

Fork, wait and execve

Fork will duplicate the process in the exact same state.

Wait will halt the parent process until the child is terminated. It cleans also all the ressources allocated to child process. If we don't call wait, we have ZOMBIE.

The execve function will replace the current running process with a new one.

Pipe and dup2

The shell can run command like so :

ls -al | cat | grep .git

Useful links:

Redirection

The redirection can be done in the two ways.

Ouput redirected :

  • It can just create a new file or remplace its content if it already exists :

      ls -al > toto
    
  • It can append the output to the end of the file :

      ls -al | grep .gitignore >> titi
    

About

A simple Shell, written in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published