Skip to content

Instantly share code, notes, and snippets.

View AlFalahTaieb's full-sized avatar
🎯
Focusing

Taieb AlFalahTaieb

🎯
Focusing
View GitHub Profile
@AlFalahTaieb
AlFalahTaieb / threePipeDemo.c
Created May 15, 2017 14:48 — forked from mplewis/threePipeDemo.c
Here's an example of how to pipe three commands together using C. This one uses `ps aux | grep root | grep sbin`. This topic is horribly documented online so hopefully this'll help someone else out.
// This program is an example of how to run a command such as
// ps aux | grep root | grep sbin
// using C and Unix.
#include <stdlib.h>
#include <unistd.h>
int pid;
int pipe1[2];
int pipe2[2];