int status=0;
int PID = fork();
if(PID == 0)
{
char *path = strcat(pathToken,strcat("/",command));
printf("path: %s\n",path);
execl(path,command,"-l",NULL);
}
else if(PID>0)
{
printf("pid: %d. ",PID);
printf("I'm parent process\n");
wait(&status);
}
输出:
pid: 20027. I'm parent process
为什么进不去if(PID==0)
?