This repository contains the Pipex project, a 42 school curriculum assignment that mimics the behavior of the Unix pipe command in C programming. This project challenges students to understand inter-process communication and the use of file descriptors to implement a basic version of a pipe. The bonus part of the project extends functionality to support here_doc feature and multiple pipes, allowing for a more complex command line data processing.
- Simulates the Unix
pipecommand to redirect the output from one process to the input of another process using file descriptors. - Handles external commands passed as arguments.
- Bonus: Implements the
here_docfunctionality similar to the shell, allowing for input redirection from a delimiter. - Bonus: Supports multiple pipes, enabling a chain of commands to be executed sequentially.
Pipex is written in C and requires the following to compile and run:
- GCC or Clang compiler
- Make (for compiling)
- Unix-based operating system (Linux or MacOS)
To compile the main Pipex project, follow these steps:
- Clone the repository to your local machine:
git clone git@github.com:akhellad/pipex.git- Navigate to the cloned directory:
cd pipex- Compile the project for the main functionality:
makeTo compile the bonus part (including here_doc and multipipe functionality), use the following command:
make bonusThis will create an executable named pipex_bonus.
To execute the Pipex program, use the following syntax:
./pipex file1 cmd1 cmd2 file2This command will take the output of cmd1 executed on file1 as its input and then use it as input for cmd2, with the final output being written to file2.
- For using the
here_docfunctionality, the syntax is:
./pipex_bonus here_doc DELIMITER cmd1 cmd2 file- For multipipe support, allowing the execution of multiple commands in a sequence, use:
./pipex_bonus file1 cmd1 cmd2 ... cmdN file2Replace file1, file2, DELIMITER, cmd1, cmd2, etc., with your actual filenames, delimiter, and commands.
This project was developed by Ahmed Khelladi, a student at Ecole 42. The Pipex project demonstrates a deep understanding of Unix piping and redirection mechanisms, enhanced with the bonus features of here_doc and multipipe support for advanced command line data processing.