LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-28-2009, 10:06 AM   #1
biplabbijay
Member
 
Registered: Jul 2009
Posts: 89

Rep: Reputation: 15
bash: 0LD_LIBRARY_PATH: command not found


HELLO EVERYBODY. I AM USING SUSE LINUX VERSION 11.0. I HAVE CREATED setup.sh FILE AS FOLLOWS:

export CPPMAKEOPT="-MM"
export CPPCOMPILE="g++ -c "
export CPPLINK="g++ "
export CPPCOMPILED="g++ -g -c "
export CPPLINKD="g++ -g "
export FORTRAN77="gfortran"
export ARCOMMAND="ar -rs"
export WCPPLIB=$HOME
export WCPPLIBOBJ=$WCPPLIB/wcpplib
export CERNLIB=/usr/lib
export SPACKLIB="-lpacklib -lnsl"
export CFLIBSERV="-lg2c"
export USE_HBOOK=1
export USE_SRANLUX=1
export USE_CPP_SRANLUX=1

export CLHEP_INCL=$HOME/CLHEP/include
if ( $?LD_LIBRARY_PATH ) then
export LD_LIBRARY_PATH=/home/hecrrc/CLHEP/lib:$LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=home/hecrrc/CLHEP/lib
fi

export HEED_PREF="$HOME"
export HEEDDIR="$HEED_PREF/heed++"
export HEED_DATABASE="$HOME/heed++/database"

export PATH="$PATH:$WCPPLIBOBJ/install"

AFTER CREATING THIS FILE WHEN I USED THE COMMAND source ~/setup/setup.sh AN ERROR MESSAGE CAME OUT :

bash: 0LD_LIBRARY_PATH: command not found
I HAVE TRIED SEVERAL OPTIOPNS BUT COULDNOT FIX IT .CAN ANYBODY HELP ME IN THIS PROBLEM ? THANKS IN ADVANCE.
 
Old 10-28-2009, 10:49 AM   #2
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
$? returns the exit value of previous command (that's where the 0 comes from). What exactly are you trying to do here:

Code:
if ( $?LD_LIBRARY_PATH ) then
export LD_LIBRARY_PATH=/home/hecrrc/CLHEP/lib:$LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=home/hecrrc/CLHEP/lib
fi
In addition you have to use [] in bash instead of (). You can test if string length is nonzero with [ ! -z "$VARIABLE" ], but you cannot use wildcards (like ?) in variable names (if that was what you tried to do?) As far as I can see, you could just use:

Code:
export LD_LIBRARY_PATH="/home/hecrrc/CLHEP/lib:$LD_LIBRARY_PATH"
There is no need for the whole if-then-else structure. It doesn't matter if LD_LIBRARY_PATH is previously unset.

Last edited by alienDog; 10-28-2009 at 10:53 AM.
 
Old 10-28-2009, 10:58 AM   #3
biplabbijay
Member
 
Registered: Jul 2009
Posts: 89

Original Poster
Rep: Reputation: 15
Error message

THANK YOU
I HAVE TRIED THAT ONE BEFORE BUT THE ERROR MESSAGE IS THEN:

bash: /home/hecrrc/setup/setup2.sh: line 20: syntax error near unexpected token `else'
bash: /home/hecrrc/setup/setup2.sh: line 20: `else '
 
Old 10-28-2009, 11:01 AM   #4
biplabbijay
Member
 
Registered: Jul 2009
Posts: 89

Original Poster
Rep: Reputation: 15
Problem is solved

Thank you verymuch. The problem is solved.
 
Old 10-28-2009, 11:03 AM   #5
alienDog
Member
 
Registered: Apr 2004
Location: Europe
Distribution: Debian, Slackware
Posts: 505

Rep: Reputation: 48
If you really really want the if-statement, you need to make it:

Code:
if [ ! -z "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH=/home/hecrrc/CLHEP/lib:$LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=home/hecrrc/CLHEP/lib
fi
But like I said, you don't really need the if-statement at all. You only need:

Code:
export LD_LIBRARY_PATH="/home/hecrrc/CLHEP/lib:$LD_LIBRARY_PATH"

Last edited by alienDog; 10-28-2009 at 11:05 AM.
 
Old 10-28-2009, 12:34 PM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Code:
    18	if ( $?LD_LIBRARY_PATH ) then
    19	export LD_LIBRARY_PATH=/home/hecrrc/CLHEP/lib:$LD_LIBRARY_PATH
    20	else
    21	export LD_LIBRARY_PATH=home/hecrrc/CLHEP/lib
    22	fi
I guess, you can change all this to something like

export LD_LIBRARY_PATH=home/hecrrc/CLHEP/lib
.....
EDIT EDIT : Sorry, typing while you said [SOLVED]
.....

Last edited by knudfl; 10-28-2009 at 12:35 PM.
 
  


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
bash: g++: command not found m_lp_ql_m Linux - Software 8 07-08-2010 01:45 PM
bash command not found gobicse Linux - Newbie 3 12-19-2007 05:46 PM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
bash: command not found intels_ss Linux - Newbie 5 07-20-2005 07:41 PM
-bash: ls: command not found jchun Linux - General 3 11-02-2004 10:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:54 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