You can run gnome-terminal
disabling the factory mode. This will prevent it from starting a terminal connected to an existing terminal, so that the command does not return immediately:
gnome-terminal --disable-factory
echo Done. # Will only run after the terminal opened above has been closed
From man gnome-terminal
:
--disable-factory
Do not register with the activation name server, do not re-
use an active terminal.
Most applications start a new process independent of any previously running processes when run. Some applications (like Firefox, GNOME Terminal, etc.) do not open a completely new process when run. They start a session tied to an existing process. So if you have a Firefox window open, and you run:
firefox
in a terminal, it will open a new window connected to the existing process and return immediately. In the case of GNOME Terminal, you can disable this behaviour using the above option. With --disable-factory
, the new window opened is tied to this command, so the command waits until the window is closed.