How to launch gnome-terminal from command line and duplicate environment variables?
-
23-09-2019 - |
Question
Is there a way to launch a gnome-terminal from the command line (i.e., using the /usr/bin/gnome-terminal command) and have the new terminal inherit the environment variables and other set variables of terminal from which the command was run? The scenario is thus:
- Open a terminal
- Set some variables
- Set some environment variables
- Launch an executable that needs the variables and the environment variables of the current terminal in a new terminal
Thoughts?
Solution
This turned out to be a gnome-terminal issue. When launching the gnome-terminal, specifying the --disable-factory
option provides the following directive:
"Do not register with the activation name server, and do not reuse an already running GNOME terminal process" (gnome-terminal man page)
Specifying this option was required in order to inherit the environment of the previous shell.
OTHER TIPS
You need to use export
against the variables in the other shell if you want child processes to inherit them.