Skip to content

Pipex is a 42 project that replicates Unix-like shell piping behavior. It takes an input file, runs a sequence of commands connected via pipes, and redirects the final output to an output file.

Notifications You must be signed in to change notification settings

droubarka/pipex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipex

Pipex reproduces the behavior of shell piping (|), executing a chain of commands with input/output redirection using pipe(), fork(), execve(), and dup2().

Usage

Cloning the Repository

To get started with the project, clone the repository to your local machine:

git clone https://github.com/droubarka/pipex.git

Running the Program

cd ./pipex
make bonus

Basic Usage

./pipex infile "cmd1" "cmd2" ... "cmdN" outfile

Equivalent to the shell command:

< infile cmd1 | cmd2 | ... | cmdN > outfile

Example:

./pipex /etc/passwd "grep -P [\w/]*/nologin$" "cut -d: -f1" nologin.txt
  • Extracts users with /nologin shells and writes their usernames to nologin.txt.

Here Document Mode (Interactive Input)

./pipex here_doc LIMITER "cmd1" "cmd2" outfile
  • Reads from standard input until LIMITER is encountered, then pipes through the commands.

About

Pipex is a 42 project that replicates Unix-like shell piping behavior. It takes an input file, runs a sequence of commands connected via pipes, and redirects the final output to an output file.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published