The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




Thread: test if
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 08-01-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
case is a shell built-in, like if and while; it's documented in the sh manual page. If you have bash (or, I suppose, any of a number of other modern shells), try help case

You have a newline before "sqlplus"; by "take out the newline" I meant, move the sqlplus command to the same line as the opening backtick.

Code:
Nbr_BD_Link=`sqlplus -S sysadm/${PSWD}@${DB_Name} << EOF
        set head off feedback off  ;
        select count(*) from dba_db_links ;
        exit ;
EOF `
echo "Nbr_BD_Link is '${Nbr_BD_Link}'"
echo "we do a test"
case ${Nbr_BD_Link} in
  *[1-9]*) echo "${T80}\nLa base ${DB_Name} contient ${Nbr_BD_Link} DB Link :" ;;
esac
Note the addition of single quotes in the diagnostic "Nbr_BD_Link is '...'" -- those are there just to help you see any possible leading or trailing whitespace.

Last edited by era; 08-01-2008 at 09:35 AM.. Reason: Also suggest "help case"