- In this project we are tasked to write a simple UNIX command interpreter like
sh
(/bin/sh
)
- We have 5 mandatory task:
- Handle command lines without arguments
- Handle command lines with arguments
- Handle the PATH
- Implement the exit built-in
- Implement the env built-in
- simple shell this is the main file for project
- excute command
- search in path
- This project follow betty style for a clean code .
- This program must have the exact same output as
sh
(/bin/sh
) as well as the exact same error output. - The only difference is when you print an error, the name of the program must be equivalent to argv[0]
- This shell work in interactive mode and in non-interactive mode
- This shell will be compiled this way:
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh
- Run:
./hsh
- In this project we use the following system call:
access
execve
exit
fork
free
getline
getpid
isatty
malloc
perror
read
stat
strtok
wait
-
In this project we learned:
-
Who designed and implemented the original Unix operating system
-
Who wrote the first version of the UNIX shell
-
Who invented the B programming language (the direct predecessor to the C programming language)
-
Who is Ken Thompson
-
How does a shell work
-
What is a pid and a ppid
-
How to manipulate the environment of the current process
-
What is the difference between a function and a system call
-
How to create processes
-
What are the three prototypes of main
-
How does the shell use the PATH to find the programs
-
How to execute another program with the execve system call
-
How to suspend the execution of a process until one of its children terminates
-
What is EOF / “end-of-file”?
- This project was done by team of two people:
- Kareem Hany
- Mohamed Elhennawy