error : test: argument expected

Hello all,

       I am trying to figure out why i am getting an error while executing the script...altought it seems like its work...but still get the test arguement error...any help would be appericiate...this script basically connects to any oracle db \( just have to pass db name to it\) and then it will clean up all old trace file etc etc...

Here is the error that i get....

/oracle/script > /oracle/script/test_purge_tracefile.ksh CONDEV
/oracle/script/test_purge_tracefile.ksh[91]: test: argument expected

The Oracle base for ORACLE_HOME=/oracle/CONDEV/112 is /oracle/CONDEV/112

---------- Post updated at 03:28 PM ---------- Previous update was at 03:26 PM ----------

It could be happening anywhere you're feeding unquoted strings into a [ ] statement. If the variable is empty it won't expand to an empty string, it'll expand to nothing causing it to complain about missing arguments.

Lines which might be doing it are:

if [ $FILESIZE -ge 20971520 ]; then

or

if [ $DB_VERSION -ge 11 ]; then

The script in debug mode does not appear to show any error. What happens if you run your script as such -

sh  /oracle/script/test_purge_tracefile.ksh CONDEV

tyler_durden

Thanks for the update, how do i avoid it then ?

---------- Post updated at 03:52 PM ---------- Previous update was at 03:50 PM ----------

no error which i run just sh and script name....

You quote them, with quotes, like every other quoted variable in your script. "${variable_in_quotes}"

You might also want to find out why these variables are ending up blank, since that's probably not what you intended.