How to start gnome-terminal from the command line and duplicate environment variables?

Is there a way to start the gnome terminal from the command line (i.e. using the / usr / bin / gnome -terminal command) and so that the new terminal inherits environment variables and other specified terminal variables from which the command was launched? So the script:

  • Open terminal
  • Set some variables
  • Set some environment variables
  • Run an executable file that needs the environment variables and variables of the current terminal in the new terminal

Thoughts?

+4
source share
2 answers

This turned out to be a gnome terminal problem. When starting the gnome terminal, specifying the --disable-factory option provides the following directive:

"Do not register with the activation name server and do not use the re-launched GNOME terminal process" (gnome-terminal manual page)

Specifying this option was required to inherit the environment of the previous shell.

+6
source

You need to use export for variables in another shell if you want child processes to inherit them.

+1
source

Source: https://habr.com/ru/post/1302553/


All Articles