![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| TAHI Test Suite 4.0.2 (Self-Test Test Suite branch) | iBot | Software Releases - RSS News | 0 | 07-10-2008 07:50 AM |
| TAHI Test Suite 3.0.15 (IPv6 Conformance Test Tool branch) | iBot | Software Releases - RSS News | 0 | 07-10-2008 07:50 AM |
| TAHI Test Suite 3.0.13 (IPv6 Conformance Test Tool branch) | iBot | Software Releases - RSS News | 0 | 04-06-2008 01:20 PM |
| test and .test in same directory | vikashtulsiyan | SUN Solaris | 14 | 12-28-2007 02:25 AM |
| Keithley Introduces Linux-Based RF Parametric Test Systems - Test and Measurement.com | iBot | UNIX and Linux RSS News | 0 | 07-23-2007 11:30 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
test if
Hi, I have this script : 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 : "
echo ${Nbr_BD_Link}
echo "we do a test"
if [ "${Nbr_BD_Link}" != "0" ] ; then
echo "${T80}\nLa base ${DB_Name} contient ${Nbr_BD_Link} DB Link :"
fi
The result of execution is Code:
Nbr_BD_Link is :
0
we do a test
--------------------------------------------------------------------------------
La base MYDB contient
0 DB Link :
As you can see, the conditional echo "${T80}\nLa base ${DB_Name} contient ${Nbr_BD_Link} DB Link :" is executed even if Nbr_Bd_Link is zero. Now I force Nbr_BD_Link to be zero : Code:
Nbr_BD_Link=0
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 : "
echo ${Nbr_BD_Link}
echo "we do a test"
Nbr_BD_Link=0
if [ "${Nbr_BD_Link}" != "0" ] ; then
echo "${T80}\nLa base ${DB_Name} contient ${Nbr_BD_Link} DB Link :"
fi
The result would be Code:
Nbr_BD_Link is : 0 we do a test The condition is respected and the conditional echo "${T80}\nLa base ${DB_Name} contient ${Nbr_BD_Link} DB Link :" is not executed. Why ? Any idea ? Any help ? thank you. May be some caracter at the end of Nbr_BD_Link ? How to keep just zero ? |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|