Skip to content

Repository files navigation

This project has been created as part of the 42 curriculum by aalemami.

Description

pipex is a Unix process management project that replicates the behavior of the shell pipe operator. It takes an input file, two commands, and an output file, chaining them together exactly as the shell does with < and > redirections and |.

The goal is to understand how processes communicate through pipes using fork, pipe, dup2, and execve, and to handle file descriptors, PATH resolution, and memory correctly.

Instructions

Compilation:

cd pipex
make

Usage:

./pipex <infile> <cmd1> <cmd2> <outfile>
Argument Description
infile File to read input from
cmd1 First command (reads from infile)
cmd2 Second command (writes to outfile)
outfile File to write final output to

Equivalent shell behavior:

< infile cmd1 | cmd2 > outfile

Examples:

./pipex infile "ls -l" "wc -l" outfile
./pipex infile "cat" "grep hello" outfile
./pipex infile "head -5" "tr a-z A-Z" outfile

Resources


AI usage:

Claude (claude.ai) was an invaluable resource throughout the project, providing clear and in-depth explanations that made tackling complex Unix concepts significantly easier.

About

A UNIX mechanism simulator in C that replicates shell pipe routing (< file1 cmd1 | cmd2 > file2) using pipe(), fork(), and execve().

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages