Pipex is a project that emulates the behavior of shell piping in a bash environment. It replicates the functionality of the following shell command:
$> < file1 cmd1 | cmd2 > file2
This program creates a pipeline between two commands, where the output of the first command (cmd1) is used as the input for the second command (cmd2). The result is then redirected to an output file (file2).
Arguments:
- file1: The input file from which data is read.
- cmd1: The first shell command to execute.
- cmd2: The second shell command to execute.
- file2: The output file where the final result is written.
To compile pipex:
- Clone the repository:
git clone [email protected]:k2matu/pipex.git
- Navigate into the directory:
cd pipex
- Compile the program using make:
make
- This will produce an executable named pipex.
After compilation, you can use the program as follows:
./pipex file1 cmd1 cmd2 file2
./pipex infile "ls -l" "wc -l" outfile
Should behave like:
< infile ls -l | wc -l > outfile
Ensure that cmd1 and cmd2 are valid shell commands and available in your system's PATH.