42-pipex

image

Introduction

This project aims to reproduce UNIX's mechanism pipe (|), which can be simply used as:

cmd1 file1 | cmd2 > file2

Where cmd1 does something with file1's data and the result goes to cmd2 in order to be changed. Then the output redirection (>) saves its result. On this project, the same command is expressed as infile cmd1 cmd2 outfile.

How to run

  1. Clone this repository on your terminal.
git clone https://github.com/julianamilson/42-pipex/
  1. Access 42-pipex repository on your computer and compile the program.
cd 42-pipex && make
  1. In order to run the program, you have to specify the file used for input, two commands and the output file's name.
./pipex infile cmd1 cmd2 outfile

Just like the example bellow:

./pipex infile cat "tr ' ' '-'" outfile
  1. Won't use it anymore? Here you go!
make fclean