The pipex project aims to provide a program that emulates the behavior of the Unix shell command pipex, allowing users to redirect the output of one command as the input to another, similar to using pipes in the command line.
The project pipex challenges students to recreate the functionality of the Unix shell command pipex, emphasizing the mastery of low-level programming concepts and a deep understanding of Unix system calls. As part of the curriculum, this project is designed to enhance students' skills in handling file descriptors, processes, pipes, and command execution, while adhering to the 42's pedagogical philosophy of peer-to-peer learning and project-based education.
- Input redirection from a file
- Output redirection to a file
- Command chaining with pipes
- Error handling for invalid input
Before proceeding with the installation, make sure you have the following dependencies:
- A Unix-like operating system (Linux, macOS, etc.)
- GCC compiler
Follow the steps below to test the project:
- Clone the repository to your local machine:
git clone git@github.com:beatrizdile/42sp-pipex.git
- Compile the project:
make
- To compile the project with bonus:
make bonus
- Run the program with the following syntax:
./pipex infile cmd1 cmd2 outfile
- infile: Input file to read data from.
- cmd1: First command to execute.
- cmd2: Second command to execute.
- outfile: Output file to write results to.
./pipex input.txt "grep keyword" "sort -r" output.txt
- To test the first part of the bonus, use three or more commands:
./pipex input.txt "grep keyword" "sort -r" "wc -l" output.txt
- To test the second part of the bonus, run:
./pipex here_doc "grep keyword" "sort -r" "wc -l" output.txt
In the second part of the bonus instead of using an already existing file as input, you use "here_doc" to write the input text yourself.