Confused with if/then

Hi All,

I'm pretty new to this so please bear with me...

I'm trying to write a bash script to first search in a file for a string of characters; if the characters exist than skip the rest of the code until you get to the last line and run that command /sbdin/ldconfig; if the string doesn't exist then add it to the file using sed and then run the last command /sbin/ldconfig.

Also too, my code looks really scrunched and I would like some suggestions, if anyone has any, on how to better construct it. Thanks for your help

Here's the code:

#!/bin/bash 

# This script installs the packages necessary 
# to run python 2.71 from a global location 
# Then adds the global location to 
# /etc/ld.so.conf and runs ldconfig

PY_GLBL=/unix_vs/local/CentOS5/lib
LD_CONF=/etc/ld.so.conf

# Installing packages

#   yum -y install blas-devel lapack-devel atlas-devel \
#   tkinter tcl tk tcl-devel tk-devel jasper jasper-devel \
#   proj proj-devel geos geos-devel

# Check for global location in $LD_CONF 
# and $PY_GLBL if necessary 

if  grep -i $PY_GLBL $LD_CONF; then
   echo "Nothing to do"
else 
   if [ ! grep -i $PY_GLBL $LD_CONF ]; then
   echo "Add Line"
    cp -p $LD_CONF $LD_CONF.`date '+%Y%m%d'` 
     sed '1a /unix_vs/local/CentOS5/lib' \
     > $LD_CONF.tmp; cp -u $LD_CONF.tmp $LD_CONF
   fi
fi

# Run ldconfig
   /sbin/ldconfig

---------- Post updated at 02:14 PM ---------- Previous update was at 02:13 PM ----------

Sorry I forgot to add the error I get when I run the script:

[root@sys etc]# /downloads/ld.sh 
/downloads/ld.sh: line 22: [: too many arguments

From a quick glance...
line 19 checks for a condition with an if, but
line 22 checks for the 'not' the same condition.

Why? It is already the 'else' function.

Got it...thx for your help