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