--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/wait.h>
+
+int main() {
+ int pipefd[2];
+ char tmpbuf;
+
+ if (pipe(pipefd) == -1) {
+ perror("Pipe creation failure\n");
+ exit(EXIT_FAILURE);
+ };
+
+ pid_t cpid = fork();
+
+ if (cpid == -1) {
+ perror("fork failure\n");
+ exit(EXIT_FAILURE);
+ } else if (cpid == 0) {
+ close(pipefd[0]);
+ dup2(pipefd[1], STDOUT_FILENO);
+ printf("[%d] Hey Jude\n", getpid());
+ //execl("/bin/ls", "ls", (char*)NULL);
+ close(pipefd[1]);
+ exit(EXIT_SUCCESS);
+ } else {
+ close(pipefd[1]);
+ printf("[%d] REDIRECTION: \n", getpid());
+ while (read(pipefd[0], &tmpbuf, 1) > 0) {
+ write(STDOUT_FILENO, &tmpbuf, 1);
+ }
+ close(pipefd[0]);
+ wait(NULL);
+ }
+
+ return EXIT_SUCCESS;
+}