سؤال

I am writhing shell script. I want three script to run in different terminal. I wrote like this in shell script,

gnome-terminal -x 1.sh

gnome-terminal -x 2.sh

gnome-terminal -x 3.sh

Then parent terminal is waiting to finish for execution of gnome-terminal -x 1.sh. It wont proceed to next script while first script running. If I run these 3 script as background process, they run in 3 different terminal window but, I m not able to kill these 3 process.

I have to manually find there process id's and kill them. I don't want to do this. Is there any better way to do it?

هل كانت مفيدة؟

المحلول

You can get their process id from the command line that launched them:

gnome-terminal -x 1.sh & pid1=$!
gnome-terminal -x 2.sh & pid2=$!
gnome-terminal -x 2.sh & pid3=$!
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top