Visit Our UNIX and Linux User Community


How to create one's own pipe in one's own shell?


 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions How to create one's own pipe in one's own shell?
# 1  
Old 01-09-2016
Wrench How to create one's own pipe in one's own shell?

Good evening, I'm trying to do my own shell and I encountered some issues while creating it. Indeed when I try such a command I have



Code:
DAUPHINE> DAUPHINE> ls -l | grep terminal > fichier 
DAUPHINE> cat fichier



My shell is named DAUPHINE
Whereas I should have:


Code:
Code:
coppan12@b042-12:~$ ls -l | grep terminal > fichier coppan12@b042-12:~$ cat fichier 
-rwxr-xr-x 1 coppan12 student   13765 déc.  18 15:18 terminal

I did in a function called commande that activate a parsing function that looks for delimiters and creates an array mot with the other words:


Code:
Code:
DAUPHINE> DAUPHINE> ls | pwd
/users/coppan12

It actually doesn't show the ls command
Have you any idea of how to fix it?

1. The problem statement, all variables and given/known data:

From the following parsing function, I had to create my own shell.
It was given from my teacher, I don't perfectly understand how it works but I did it but the pipe and the redirection with the pipe.


Code:
void parsing(){     int i=0;     int cmot=0;     while(1){         c = getchar();         if      (c == '\n') {symboleP = 0;return;}         else if (c == ';')  {symboleP = 1;return;}         else if (c == '&')  {symboleP = 2