LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Failure running program in a directory on my PATH variable (https://www.linuxquestions.org/questions/linux-software-2/failure-running-program-in-a-directory-on-my-path-variable-4175656364/)

chiendarret 06-25-2019 12:10 PM

Failure running program in a directory on my PATH variable
 
I am quite confused about running a program (molden) that is on my PATH variable. Typing its name does work on my VAIO laptop while it does not work on my GPU gig64 workstation. With the latter I have to dig into the directory where the program is, and type ./program_name (thereafter it works correctly also with the workstation, actually better owing to the GPUs). Curiously,

which molden

gives the correct answer only with VAIO, although in both cases $PATH has the same output

francesco@vaio64:~$ $PATH
bash: /opt/molden:..........

francesco@gig64:~$ SPATH
bash: /opt/molden:.....


resulting from the same setting of .bashrc with VAIO and gig64

# For molden
export PATH="/opt/molden:$PATH"
LD_PRELOAD=/opt/molden/libgfortran.so.3 /bin/ls
export LD_PRELOAD=/opt/molden/libgfortran.so.3

(the LD_PRELOAD because my Debian is at so.4 while the compilation was at so.3)

Thanks for advice

chiendarret

MensaWater 06-25-2019 01:54 PM

In your second instance you show "SPATH" rather than "$PATH". Is that a typo?

To see the contents of variables you should type "echo $<VAR>" rather than just "$<VAR>". e.g. echo $PATH
Otherwise you risk executing something unintended.

When you type "which molden" what exactly is the output you see on the one where it fails? Is it possible it finds another "molden" elsewhere in your PATH?

chiendarret 06-25-2019 03:22 PM

Yes, a typo.

GIG64 where it does not work
francesco@gig64:~$ echo $PATH
opt/molden:/opt/NAMD_2.12_Linux-x86_64-multicore:/opt/anaconda2/bin:/opt/MGLTools-1.5.6/bin:/opt/vina_1_1_2_linux_x86/bin:opt/molden:/opt/NAMD_2.12_Linux-x86_64-multicore:/opt/anaconda2/bin:/opt/MGLTools-1.5.6/bin:/opt/vina_1_1_2_linux_x86/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/UCSF/Chimera64-1.11.2/bin:/opt/VMD:/opt/vina_1_1_2_linux_x86/bin/vina:/opt/NAMD_2.12_Linux-x86_64-multicore/namd2:/opt/UCSF/Chimera64-1.11.2/bin:/opt/VMD:/opt/vina_1_1_2_linux_x86/bin/vina:/opt/NAMD_2.12_Linux-x86_64-multicore/namd2
francesco@gig64:~$ which molden
francesco@gig64:~$ which gmolden
francesco@gig64:~$
i.e., nothing from "which"

VAIO where it works (if anything, it is unclear why the PATH variable is reated for molden, while there is a single instance of that and only .bashrc was used, no .profile ; the same issue for "mopac")
francesco@vaio64:~$ echo $PATH
/opt/molden:/opt/mopac:/usr/local/lib/plugins/LINUXAMD64/bin/catdcd5.2:/opt/NAMD_Git-2018-11-27_Linux-x86_64-multicore:/opt/anaconda2/bin:/opt/MGLTools-1.5.6/bin:/opt/vina_1_1_2_linux_x86/bin:/opt/molden:/opt/mopac:/usr/local/lib/plugins/LINUXAMD64/bin/catdcd5.2:/opt/NAMD_Git-2018-11-27_Linux-x86_64-multicore:/opt/anaconda2/bin:/opt/MGLTools-1.5.6/bin:/opt/vina_1_1_2_linux_x86/bin:/opt/molden:/opt/mopac:/usr/local/lib/plugins/LINUXAMD64/bin/catdcd5.2:/opt/NAMD_Git-2018-11-27_Linux-x86_64-multicore:/opt/anaconda2/bin:/opt/MGLTools-1.5.6/bin:/opt/vina_1_1_2_linux_x86/bin:/opt/molden:/home/francesco/softw/MSMS:/opt/mopac:/usr/local/lib/plugins/LINUXAMD64/bin/catdcd5.2:/opt/NAMD_Git-2018-11-27_Linux-x86_64-multicore:/opt/anaconda2/bin:/opt/MGLTools-1.5.6/bin:/opt/vina_1_1_2_linux_x86/bin:/opt/molden:/home/francesco/softw/MSMS:/opt/mopac:/usr/local/lib/plugins/LINUXAMD64/bin/catdcd5.2:/opt/NAMD_Git-2018-11-27_Linux-x86_64-multicore:/opt/anaconda2/bin:/opt/MGLTools-1.5.6/bin:/opt/vina_1_1_2_linux_x86/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:usr/local/sbin:/opt/UCSF/Chimera64-1.13.1rc/bin:/opt/vina_1_1_2_linux_x86/bin/vina:/opt/namd_Git-2018-11-27_Linux-x86_64-multicore/namd2:/opt/UCSF/Chimera64-1.13.1rc/bin:/opt/vina_1_1_2_linux_x86/bin/vina:/opt/namd_Git-2018-11-27_Linux-x86_64-multicore/namd2:/opt/UCSF/Chimera64-1.13.1rc/bin:/opt/vina_1_1_2_linux_x86/bin/vina:/opt/namd_Git-2018-11-27_Linux-x86_64-multicore/namd2:/opt/UCSF/Chimera64-1.13.1rc/bin:/opt/vina_1_1_2_linux_x86/bin/vina:/opt/namd_Git-2018-11-27_Linux-x86_64-multicore/namd2:/opt/UCSF/Chimera64-1.13.1rc/bin:/opt/vina_1_1_2_linux_x86/bin/vina:/opt/namd_Git-2018-11-27_Linux-x86_64-multicore/namd2
francesco@vaio64:~$
francesco@vaio64:~$ which molden
/opt/molden/molden
francesco@vaio64:~$ which gmolden
/opt/molden/gmolden
francesco@vaio64:~$

scasey 06-25-2019 04:33 PM

Please use [code] tags when posting output, for readability.

The which command only searches directories within PATH, so having no output means that the command molden is not located in a PATH directory, i.e., it's not in /opt/molden

As root, try
Code:

find / -name molden -ls
to find the actual location of the molden command.

Or. You say (imply) you can cd to /opt/molden then execute it by entering ./molden -- did I understand that correctly?
If that's the case, please
Code:

ls -l /opt/modlen

MadeInGermany 06-25-2019 08:44 PM

Code:

francesco@gig64:~$ echo $PATH
opt/molden:/opt/NAMD_2.12_Linux-x86_64-multicore:...

is missing a leading /
Must be
Code:

francesco@gig64:~$ echo $PATH
/opt/molden:/opt/NAMD_2.12_Linux-x86_64-multicore:...


ehartman 06-26-2019 01:05 AM

Quote:

Originally Posted by MadeInGermany (Post 6009088)
PATH
is missing a leading /

Good catch, that probably will be the problem to the OP.

chiendarret 06-26-2019 01:17 AM

Yes, the error came from .bashrc, lacking /. Thanks a lot


All times are GMT -5. The time now is 02:25 PM.