This project is a simplified implementation of shell pipelines. It mimics the shell's ability to pipe commands using the | operator. The program handles input/output redirection and command execution using fork(), execve(), and pipe() system calls.
./pipex infile "cmd1" "cmd2" outfileEquivalent to:
< infile cmd1 | cmd2 > outfile./pipex input.txt "grep hello" "wc -l" output.txtThis reads from input.txt, runs grep hello, pipes the result into wc -l, and writes the output to output.txt.
./pipex here_doc LIMITER cmd1 cmd2 ... cmdN outfileSupports:
- Multiple commands (cmd1 | cmd2 | ... | cmdN)
- here_doc functionality: reads input from stdin until the given LIMITER.
- Appends to the output file if here_doc is used.
Bonus Example
./pipex here_doc END "cat" "grep hello" "wc -l" output.txtβββ include/
β βββ pipex.h # Header file for mandatory part
β βββ pipex_bonus.h # Header for bonus features
βββ libft/ # Libft library
βββ src/
β βββ main.c # Entry point for mandatory part
β βββ process.c # Process execution (mandatory)
β βββ pathfinder.c # PATH resolution for commands
β βββ helpers.c # Common error/child handlers
βββ src_bonus/
β βββ main_bonus.c # Entry for bonus (multi-pipe, here_doc)
β βββ process_bonus.c # Process handling with multiple pipes
β βββ pathfinder.c # PATH resolution for commands
β βββ helpers.c # Common error/child handlers
βββ Makefile # Builds the project and handles rules
βββ README.md # You're reading it!To build the project, run:
make # Builds the mandatory version
make bonus # Builds the bonus version
make clean # Removes object files
make fclean # Removes all binaries and objects
make re # Rebuilds everythingCreated and maintained by Martin Justa as part of the 42 school curriculum.