#include #include #include #include #include int main() { char line[1000]; while (1) { printf("Ready: "); char * s = fgets(line, 999, stdin); if (s == NULL) break; if (strcmp(line, "exit\n") == 0) break; else if (strcmp(line, "hello\n") == 0) printf("Hello to you too\n"); else if (strcmp(line, "files\n") == 0) { int s, p = fork(); if (p == 0) { execlp("ls", "ls", "-l", NULL); printf("exec failed\n"); exit(1); } p = wait(& s); } else printf("I don't understand %s", line); } printf("exitting\n"); }