0

I had to add an:

export PATH="/path/to/my/bin:$PATH"

to my bash.rc, for progA's binary library location. Now, whenever I start a GNOME Terminal instance, I can type progA and hit return and the right binary is executed.

However, if I run progA through a GUI launched app, my system fumbles and doesn't know where progA's bin is.

What should I do?

2 Answers 2

1

The ~/.bashrc file is only processed for interactive, non-login shells: probably a better place to set the path would be your ~/.profile

For maximum portability, you could follow the existing paradigm of the user's ~/bin directory in ~/.profile (i.e. avoiding export, and testing for the directory's existence): something like

if [ -d "/path/to/my/bin" ] ; then
    PATH="/path/to/my/bin:$PATH"
fi

Since ~/.profile is only read for login shells, you will need to log out and back in for it to take effect (or at least, start a new login shell e.g. using su - username). From there, the new PATH should propagate to all child shells - including the interactive, non-login shells of your gnome terminals.

1

First, whatever is inside .bashrc applies only to bash shell. Unless that mysterious GUI-launched app that you refer to also uses .bashrc ( for which I don't see any reason whatsoever ), then it won't know where is your progA. Even the run dialog (which is Alt+F2 if you didn't know ) uses dash not bash , so .bashrc means nothing to it. That's for one.

Second, If what you want is to have a desktop or launcher shortcut, you need to have a myAppName.desktop file with the following contents:

[Desktop Entry]
Name=myAppName
Type=Application
Exec=/path/to/the/progA
Terminal=false
Icon=/path/to/some/icon.png

Now when you have that and the file is executable, you can double click that .desktop file and launch the app (provided that progA has ownership properly set, permissions set and executable bit set ). Icon= part is optional, so you could leave it out.

You must log in to answer this question.