LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-25-2019, 12:10 PM   #1
chiendarret
Member
 
Registered: Mar 2007
Posts: 307

Rep: Reputation: 16
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
 
Old 06-25-2019, 01:54 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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?
 
Old 06-25-2019, 03:22 PM   #3
chiendarret
Member
 
Registered: Mar 2007
Posts: 307

Original Poster
Rep: Reputation: 16
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/binpt/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:~$
 
Old 06-25-2019, 04:33 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,732

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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
 
1 members found this post helpful.
Old 06-25-2019, 08:44 PM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,805

Rep: Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206
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:...
 
3 members found this post helpful.
Old 06-26-2019, 01:05 AM   #6
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by MadeInGermany View Post
PATH
is missing a leading /
Good catch, that probably will be the problem to the OP.
 
1 members found this post helpful.
Old 06-26-2019, 01:17 AM   #7
chiendarret
Member
 
Registered: Mar 2007
Posts: 307

Original Poster
Rep: Reputation: 16
Yes, the error came from .bashrc, lacking /. Thanks a lot
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Failure after failure after failure.....etc 69Rixter Linux - Laptop and Netbook 5 04-14-2015 09:58 AM
Add path to $PATH variable alaios SUSE / openSUSE 2 04-19-2009 08:41 AM
bash script path issue - how to pass a path as a string to a variable PiNPOiNT Programming 5 04-17-2009 05:48 PM
AWK a variable Ouptut to a new variable and using the new variable with the old one alertroshannow Linux - Newbie 4 02-16-2009 12:08 AM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 02:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration