Skip to content

garcia2/42_pipex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pipex

pipex is a project from 42 school focused on reproducing the behavior of piping (|) in Unix systems. The goal is to implement a program that mimics the shell's capability to redirect the output of one command as the input to another, utilizing Unix system calls.

Table of Contents

  1. Overview
  2. Features
  3. Installation
  4. Usage
  5. Example
  6. Author

Overview

The pipex project aims to recreate the Unix pipe functionality, allowing the output of one command to serve as the input to another. This project offers valuable experience with process management, file descriptors, and inter-process communication using pipes.

Features

  • Executes two commands with a pipe, where the output of the first command is redirected to the input of the second.
  • Utilizes pipe(), dup2(), and fork() system calls.
  • Supports input and output redirection to files.

Installation

To use pipex, start by cloning the repository and compiling the program.

git clone https://github.com/garcia2/42_pipex
cd 42_pipex
make

This will create an executable named pipex.

Usage

The syntax for running the pipex program is as follows:

./pipex infile cmd1 cmd2 outfile
  • infile : The input file for cmd1.
  • cmd1 : The first command, which reads from infile.
  • cmd2 : The second command, which takes the output of cmd1 as input.
  • outfile : The file where the output of cmd2 will be saved.

Example

Assuming you have two commands, cat and grep, you can use pipex to replicate the shell behavior of cat infile | grep "text" > outfile:

./pipex infile "cat" "grep text" outfile

This command will read from infile, apply cat to it, then filter the output using grep "text", and finally write the result to outfile.

Author

Project developed by Nicolas Garcia as part of 42 school.

About

42 school project pipex

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published