Kill bash and child process
问题 My C program executes commands in a bash shell. To do this, I fork and in the child process I run: char* command = "..."; /* provided by user */ execlp("/bin/bash", "bash", "-c", command, NULL); If this is a long running command, I would like to have the option of killing it. For example, say I'm doing: execlp("/bin/bash", "bash", "-c", "find / test", NULL); After this, I know the PID of the child that is executing bash, but bash is forking a separate process to execute find. $ ps aux | grep