linux - Ctrl + C to terminate "grunt watch", but kills Atom editor which started from the same bash, why? -


i have script named wsjs.sh:

#!/bin/bash ws=/home/user/wsjs cd $ws nohup atom . &  gnome-terminal grunt watch 

if run in bash:

./wsjs.sh 

then atom editor, gnome-terminal started separately, , current bash showing:

user@ubuntu:~$ ./wsjs.pwd  nohup: appending output ‘nohup.out’ running "watch" task waiting... 

now if press ctrl + c, grunt watch quits, atom editor closed.

...this weird.

i manually entered every command in bash, , atom not closed. replaced atom gedit , run script, not closed.

why atom closed ? thanks!

this causes because while executing shell script, has process id , command inside file executing have parent process id of script file. while terminating or ctl+c script file, terminate child processes (in case

cd $ws nohup atom . &  gnome-terminal grunt watch 

) while executing individual command have independent process ids.

hope got idea.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -