A Unix command-line tool built in C, designed to replicate shell pipelines and reinforce understanding of process management, file descriptors, and inter-process communication. Pipex allows executing commands with redirected input and output, mimicking basic Bash pipeline behavior.
- Command execution with exactly 2 commands
- Input/output redirection (
<and>) - Pipeline connecting the two commands
- Error handling consistent with shell behavior
- Memory-safe execution with no leaks
- Support for multiple commands in a pipeline
- Here-documents (
<<) support - Enhanced error handling for edge cases
- Dynamic number of commands in the pipeline
- C – Core language
- POSIX system calls –
fork,execve,pipe,dup2,waitetc. - Makefile – For easy build and management
- Clone the repository:
git clone https://github.com/Felipp3san/42-pipex
cd 42-pipex- Compile the project:
make # Compile mandatory version
make bonus # Compile bonus version- Run the executable:
./pipex file1 cmd1 cmd2 file2 # Mandatory
./pipex file1 cmd1 cmd2 ... cmdn file2 # Bonus- Mandatory (2 commands only):
./pipex infile "grep hello" "wc -l" outfileThis executes grep hello < infile | wc -l > outfile.
- Bonus (multiple commands):
./pipex input.txt "cat" "grep data" "sort" output.txt- Bonus: Here-document:
./pipex here_doc LIMITER "cat" "wc -l" outfileAllows input until LIMITER is reached.
- Build the mandatory executable:
make- Build the bonus executable:
make bonus- Remove object files:
make clean- Remove all binaries and rebuild:
make reEducational project under 42 School academic policy.