Skip to content

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XPipe

XPipe is a project recreates a simple version of shell pipes (|) in C. It allows you to connect multiple commands, so the output of one command becomes the input of the next, just like in a real shell, It also supports heredoc mode which lets you provide input directly in the terminal.

What XPipe Does :

  • Reads input from a file or command.
  • Passes the output of one command to the next using pipes.
  • Writes the final output to another file.
  • Uses system calls like pipe(), fork(), execve(), and waitpid() to manage processes and communication.

Example Usage :

1|-> Run the following sh cmd:

make

2|-> usage example

./pipex infile "cmd1" "cmd2" outfile

NOTE:
It works exactly like this in the shell:

< infile cmd1 | cmd2 > outfile

This means:

1_ cmd1 reads from infile

2_ cmd1 sends its output to cmd2 through a pipe

3_ cmd2 writes its final output to outfile

Cleanup

  • Remove object files:
make clean
  • Remove all binaries and object files:
make fclean

About

XPipe works like a shell pipeline by connecting commands with pipes, It focuses on process management and IPC using system calls like fork, exec, and pipe.

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages