#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
int main()
{
char buffer[512];
while (1) {
printf("$ ");
fgets(buffer, 512, stdin);
*strchr(buffer, '\n') = '\0';
char *token[16] = { 0 };
token[0] = strtok(buffer, " ");
for (int i = 1; token[i] = strtok(NULL, " "); ++i);
pid_t pid = fork();
if (pid)
waitpid(pid, &pid, WUNTRACED);
else
execvp(token[0], token);
}
return 0;
}
you "need" more?