CPak
CPak

Reputation: 13591

grep pattern in LD_LIBRARY_PATH

I want to export a folder to LD_LIBRARY_PATH but only once. I tried the following to determine if the folder was already present

 if !(grep --quiet "libBigWig/include" $LD_LIBRARY_PATH)
 then
     echo "passed"
 fi

but it prints the statement. Here's my LD_LIBRARY_PATH

/etc:/etc/lib64:/path-to-lib/libBigWig/include

Upvotes: 0

Views: 187

Answers (1)

andrefsp
andrefsp

Reputation: 3710

You could try something like:

if [ `echo $LD_LIBRARY_PATH | grep 'libBigWig/include'` = '' ] 
then 
    echo 'Not present..'
fi

Would this help?

Upvotes: 1

Related Questions