Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <unistd.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <string.h>
- #include <stdio.h>
- int main(int argc, char *argv[])
- {
- int id, s;
- int bk = 1;
- char input[100];
- while (bk = 1)
- {
- printf("user@ubuntu: ");
- scanf("%s", input);
- int ex = strcmp(input, "exit");
- if (ex == 0)
- {
- break;
- }
- else
- {
- id = fork();
- if (!(id == 0))
- {
- wait(&s);
- }
- else
- {
- execlp(input, input, NULL);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement