Pipex is a Unix-based project developed in C as part of the 42 School curriculum, focused on mastering file descriptors, process creation, and inter-process communication using pipes.
The program mimics the shell's piping behavior (e.g., ls | grep txt
) by executing chained commands with input/output redirection. In the bonus part, we extended the functionality to support multiple pipes, here_doc
, and command path resolution with flexible argument parsing.
Throughout the project, we explored:
fork()
,execve()
, andwait()
system calls- File descriptor duplication and redirection with
dup2()
- Handling environment paths (
PATH
) and command resolution - Creating a shell-like environment with minimal tools
Clone the repository:
git clone https://github.com/joseevilasio/pipex_42.git
Enter the project directory:
cd pipex_42
Run make
to build the mandatory version:
make
Run make bonus
to build the extended version:
make bonus
./pipex infile "cmd1" "cmd2" outfile
Example:
./pipex input.txt "grep hello" "wc -l" output.txt
This will execute: < input.txt grep hello | wc -l > output.txt
Supports:
- Multiple commands (
cmd1 | cmd2 | ... | cmdN
) here_doc
functionality for inline input
Example:
./pipex here_doc LIMITER "cmd1" "cmd2" outfile
This project follows the 42 School's "The Norm" (Version 4). To review the Norm, click here.
Issues, improvements or suggestions are welcome via pull request or GitHub issue.
Understanding the flow of file descriptors and how processes interact at the system level is key to this project. Take time to visualize your pipeline and test edge cases. The bonus part is not just harder — it’s where you grow the most.