In this project, you can see how to implement fork and shell simply.
There have two different examples.
- use wait(&) to control process parent and process child.
- without wait(&).
wait(&) -- means if process parent want to run, it need to wait process child has finished.
Ex:
-
use wait
I am a child, my name is 526852,
and My dad's name is 526851.
I have a brother, his name is 526853.
Also, my grandpa's name is 526850. -
without wait
My name is 526856.
Grandpa's name is 526854
Dad's name is 526855.
Brother's name is 526857.
In this program, it can run some standard pipe or CLI.
Ex:
- ls
- ls -a
- ls -l
- ls -al
- ls -al > output1 > output2 > output3
- ls -al < output1 < output2 < output3