C > Gnu-Linux
A very simple shell
A very simple shell #include
#include
#include
#include
int main(void) { char command[BUFSIZ]; int status; pid_t pid; for(;;) { printf("simpsh: "); if(fgets(command, sizeof(command), stdin) == NULL) { printf("\n"); return 0; } command[strlen(command) - 1] = '\0'; if((pid = fork()) == 0) execlp(command, command, 0); while(wait(&status) != pid) continue; printf("\n"); } }
C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting