Skip to content
/ pipex Public

Pipex reproduces the behaviour of the shell pipe | command in C. It launches as ./pipex infile cmd1 cmd2 outfile and behaves as this line does in the shell < infile cmd1 | cmd2 > outfile .

Notifications You must be signed in to change notification settings

gkrusta/pipex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipex

Overview

Pipex reproduces the behavior of the shell pipe command in C.

Usage

To use Pipex, follow these steps:

  1. Clone the repository:

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

  2. Compile the program:

make

  1. Create an infile (if you want) and run the program with the desired commands:

./pipex infile "cmd1" "cmd2" outfile

  • infile: The input file from which data is read.
  • cmd1: The first command to be executed. Its output is piped to cmd2.
  • cmd2: The second command to be executed.
  • outfile: The output file where the final result is written.

Bonus Features

Pipex also provides additional features, including:

Managing multiple pipes:

./pipex file1 "cmd1" "cmd2" "cmd3" ... "cmdN" file2

This command processes data from file1 through multiple commands (cmd1, cmd2, cmd3, ..., cmdN) and writes the final result to file2. It behaves similarly to a chain of shell commands separated by pipes.

Accepting << and >> when the first parameter is "here_doc":

./pipex here_doc DELIMITER "cmd" "cmd1" outfile

This command processes input data by accepting lines until the DELIMITER is encountered. It then pipes the output of cmd and cmd1 to outfile. This mimics the behavior of shell "here documents."

Stuff and sources I used

About

Pipex reproduces the behaviour of the shell pipe | command in C. It launches as ./pipex infile cmd1 cmd2 outfile and behaves as this line does in the shell < infile cmd1 | cmd2 > outfile .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published