Skip to content
/ pipex Public

pipex is a 42 school project aimed to better understand shell redirection and pipes, by handling them in C.

Notifications You must be signed in to change notification settings

jhesso/pipex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pipex

pipex is a 42 school project aimed to better understand shell redirection and pipes, by handling them in C.

This pipex program takes an input file, performs a command on it, pipes the result to another command which then writes its result to an output file. The result is virtually identical to this kind of shell command:

$ < input_file command1 | command2 > output file

Status

Waiting for evals

Usage

To compile, use make, make all or make bonus.

Regular pipex execution

Pipex can handle 2 or more commands. To execute:

$ ./pipex input_file command1 command2 ... commandn output_file

The output will be written to the specified output file. If the output file exists, it will be overwritten. This replicates the shell command:

$ < input_file command1 | command2 | ... | commandn > output_file

Each command can be given arguments and options if surrounded by quotation marks. For example:

$ ./pipex example.txt "cat" "grep x" "sed s/l/.../g" outfile.txt

Pipex heredoc execution

You can also run pipex with a heredoc, like this:

$ ./pipex here_doc LIMITER command1 command2 ... commandn output_file

You will then be asked to input text which will be used as input for the commands. In this case, the specified output file will not be overwritten but appended, which replicates the behavior of the shell command:

$ << LIMITER command1 | command2 | ... | commandn >> output_file

Made by jhesso: [email protected] | LinkedIn: jhesso

About

pipex is a 42 school project aimed to better understand shell redirection and pipes, by handling them in C.

Topics

Resources

Stars

Watchers

Forks