This is a shell program, in the last part im trying to link multiple processes through piping. This seems to work just fine: ls directs its output to grep and the output of grep is then printed. The problem is that the shell terminates after grep prints or just hangs in an empty line untill ctrl-C is pressed resulting in the shell being terminated. The current output of the program when ls is used:
gijs@ubuntu:~/Documents/Besturings_systemen/Shell$ ./shell
/home/joeri/Documents/Besturings_systemen/Shell $ ls
commands
commands~
shell.c
shell.c~
try.c~
Untitled Document~
->(terminal hangs here)<-
The code: [C] Shell - Pastebin.com