0

When i run gnome-terminal with the -e to execute a command the PATH used to find the command is not the PATH used in the terminal initiating the command

For example:

I open an terminal and set the PATH to be "./:$PATH

type in gnome-terminal -e cluster_node

It can't find the cluster node. if I type gnome-terminal -e ./cluster_node it works

If I add in the /etc/environment the PATH ./ then it works always/

I think it doesn't use the terminal environment PATH from which it was launched.

1
  • You have to export your $PATH. At any rate, it is better to install your /luster_node in a standard location ( /usr/local/ ) or add the proper (full) path to your $PATH as "./" is ambiguous .
    – Panther
    May 28, 2014 at 19:53

1 Answer 1

2

For a new variable, you can export it, such as:

> export NEWVAR=something

However as in this case, the PATH variable is set by the shell's initialization scripts (/etc/profile, ~/.bashrc, etc). Changes to PATH in the parent shell are blown away by those initialization scripts in the child shell. Options you have:

  1. Ensure whatever you are trying to run is in a well-known location (/usr/local/bin, etc)
  2. Ensure you specify the full path when you run gnome-terminal
  3. Reset the variable as part of the execution:

    gnome-terminal -x bash -c 'export PATH=$PATH:/.; whatever.sh'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .