Skip to content

A project to recreate the behavior of the Unix shell command pipex, allowing for input/output redirection and command chaining.

Notifications You must be signed in to change notification settings

beatrizdile/42sp-pipex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42 Cursus

pipex

pipex Logo

The pipex project aims to provide a program that emulates the behavior of the Unix shell command pipex, allowing users to redirect the output of one command as the input to another, similar to using pipes in the command line.

Description

The project pipex challenges students to recreate the functionality of the Unix shell command pipex, emphasizing the mastery of low-level programming concepts and a deep understanding of Unix system calls. As part of the curriculum, this project is designed to enhance students' skills in handling file descriptors, processes, pipes, and command execution, while adhering to the 42's pedagogical philosophy of peer-to-peer learning and project-based education.

Features

  • Input redirection from a file
  • Output redirection to a file
  • Command chaining with pipes
  • Error handling for invalid input

Installation

Before proceeding with the installation, make sure you have the following dependencies:

  • A Unix-like operating system (Linux, macOS, etc.)
  • GCC compiler

Follow the steps below to test the project:

  1. Clone the repository to your local machine:
git clone git@github.com:beatrizdile/42sp-pipex.git
  1. Compile the project:
make
  1. To compile the project with bonus:
make bonus
  1. Run the program with the following syntax:
./pipex infile cmd1 cmd2 outfile
  • infile: Input file to read data from.
  • cmd1: First command to execute.
  • cmd2: Second command to execute.
  • outfile: Output file to write results to.

Examples

./pipex input.txt "grep keyword" "sort -r" output.txt

Test Bonus

  1. To test the first part of the bonus, use three or more commands:
./pipex input.txt "grep keyword" "sort -r" "wc -l" output.txt
  1. To test the second part of the bonus, run:
./pipex here_doc "grep keyword" "sort -r" "wc -l" output.txt

In the second part of the bonus instead of using an already existing file as input, you use "here_doc" to write the input text yourself.

About

A project to recreate the behavior of the Unix shell command pipex, allowing for input/output redirection and command chaining.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published