An implementation of the shell's pipe operator, using the pipe() system call and file descriptors to pass data between processes.
This program mimicks the pipe operator, connecting the inputs and outputs of various commands by redirectioning them to the pipe file descriptors. The simple version works with 2 commands, while the bonus version can strong to together multiple bash commands.
-
make
creates the executable named "pipex" -
make clean
removes object files -
make fclean
removes object files and the executable -
make re
callsfclean
followed byall
-
make bonus
compiles bonus part where multiple commands can be used
Simple:
./pipex [infile] [command1] [command2] [outfile]
Bonus:
./pipex [infile] [command_1] [command_2] ... [command_n] [outfile]
Simple:
./pipex infile "ls -l" "wc -l" outfile
should behave like < infile ls -l | wc -l > outfile
Bonus:
./pipex infile cmd_1 cmd_2 ... cmd_n outfile
should behave like < infile cmd_1 | cmd_2 | ... | cmd_n > outfile
infile: file that is redirected to STDIN (input of the program)
outfile: file that is redirected to STDOUT (output of the program)
command_1/ command_2 /... / command_n: bash commands