문제

I have:

$ cat ./test
#!/bin/bash

gulp dev &

Then run it:

$ ./test
...

(.. hit enter to get command prompt) The command in the script starts node process. But I haven't it among background processes:

$ jobs -p

prints empty list. So the aim is to be able to list/kill (multiple) processes started and detached inside a single script. How to?

도움이 되었습니까?

해결책

Your interactive shell only manages the jobs that it started. When you run a script as a command, the background processes are started by the subshell, not the original shell.

You need to source the script, so that it will be run by your interactive shell:

source ./test
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top