QUESTION

Write a C program, call it myBash, to act like Bash. Your program should go in an infinite loop waiting for the user to enter a line of commands (single or multiple). Once a line is entered, your program should assemble and execute each command and perform piping if needed. To make it simple, you can assume that piping is limited to two commands only.

The commands/programs location can be anywhere in your $PATH and might have arguments.

Examples of input lines entered by the user :

myBash> ps -e

myBash> more letter.txt | wc -c

myBash> ps -ef; date ; echo Good Day

In particular, you should only use Unix I/O system calls.

Public Answer

TH8GTP The First Answerer