Skip to content
/ pipex Public

Implementation of the shell's pipe operator.

Notifications You must be signed in to change notification settings

ys-zm/pipex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An implementation of the shell's pipe operator, using the pipe() system call and file descriptors to pass data between processes.


Overview:

This program mimicks the pipe operator, connecting the inputs and outputs of various commands by redirectioning them to the pipe file descriptors. The simple version works with 2 commands, while the bonus version can strong to together multiple bash commands.


Compiling:

  1. make creates the executable named "pipex"

  2. make clean removes object files

  3. make fclean removes object files and the executable

  4. make re calls fclean followed by all

  5. make bonus compiles bonus part where multiple commands can be used


Usage:

Simple:

./pipex [infile] [command1] [command2] [outfile]

Bonus:

./pipex [infile] [command_1] [command_2] ... [command_n] [outfile]

Example:

Simple: ./pipex infile "ls -l" "wc -l" outfile should behave like < infile ls -l | wc -l > outfile

Bonus: ./pipex infile cmd_1 cmd_2 ... cmd_n outfile should behave like < infile cmd_1 | cmd_2 | ... | cmd_n > outfile

Parameters:

infile: file that is redirected to STDIN (input of the program)

outfile: file that is redirected to STDOUT (output of the program)

command_1/ command_2 /... / command_n: bash commands

About

Implementation of the shell's pipe operator.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published