This question already has an answer here:

I'm using bash to run a terminal which launches a few programs in separate tabs. However, after the terminal opens, it seems like my script continues even though generally this only happens if we use the ampersand (&).

Here is an example of what I'm talking about:

gnome-terminal --tab -e "./run_script.sh"


The behavior I'm seeing now is that gnome-terminal executes, and then immediately after the second command is executed. The desired behavior for myself is that the second command only executes when the gnome-terminal process ends.

Is there any way to halt the script until gnome-terminal completes?


According to the question linked, Run true multiple process instances of gnome-terminal, --disable-factory was an argument that would accomplish this. However, --disable-factory is deprecated and is no longer availble.

That thread also links here: https://wiki.gnome.org/Apps/Terminal/Debugging , which gives a method using GDB. However, I don't think this approach will work for me.

marked as duplicate by JdeBP, Jeff Schaller, RalfFriedl, mosvy, Thomas Nov 30 '18 at 10:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.