Help me with this error message : test: argument expected

Help me with this error message : test: argument expected

Post by Kunal Pat » Sat, 14 Sep 2002 06:54:49



Here is the script I am trying to write

#!/usr/bin/sh

ORACLE_HOME=/opt/oracle8/product/8.1.7
JAVA_HOME=/usr/java1.2
JAVA_LIBS=/home/kpatil/myclasses/smtp.jar:/home/kpatil/myclasses/activation.jar:$ORACLE_HOME/jdbc
/lib/classes12.zip
SCRIPT_DIR=/home/kpatil/visteon
FLUSH_DIR=$SCRIPT_DIR/dbload/flushes

echo $1 | grep -i "830" > /dev/null
if [ $? -eq 0 ]
then
  echo Visteon DB Load Files
  PROCESS_FILE=`echo $1 | awk -F/ '{ print $NF }'`
  echo "Trying to process file $PROCESS_FILE";
  if [ -e "$FLUSH_DIR/${PROCESS_FILE}.flushes" ]
  then
        echo "File with same name has been processed" | mail

  else
  cd $SCRIPT_DIR/dbload;
  $JAVA_HOME/bin/java -classpath $JAVA_LIBS:$SCRIPT_DIR/dbload
VisteonDBLoad -f $1 2>&1 | mail kp

  if [ -e "$1.flushes" ]
   then
        mv $1.flushes $SCRIPT_DIR/dbload/flushes
  fi
  fi
fi

-- END

I guess it is failing on  'if [ -e
"$FLUSH_DIR/${PROCESS_FILE}.flushes" ]' with error test: argument
expected. What am I doing wrong here?

Thanks,
Kunal Patil

 
 
 

Help me with this error message : test: argument expected

Post by Chris F.A. Johnso » Sat, 14 Sep 2002 07:16:36



> Here is the script I am trying to write

> #!/usr/bin/sh

> ORACLE_HOME=/opt/oracle8/product/8.1.7
> JAVA_HOME=/usr/java1.2
> JAVA_LIBS=/home/kpatil/myclasses/smtp.jar:/home/kpatil/myclasses/activation.jar:$ORACLE_HOME/jdbc
> /lib/classes12.zip
> SCRIPT_DIR=/home/kpatil/visteon
> FLUSH_DIR=$SCRIPT_DIR/dbload/flushes

> echo $1 | grep -i "830" > /dev/null
> if [ $? -eq 0 ]
> then
>   echo Visteon DB Load Files
>   PROCESS_FILE=`echo $1 | awk -F/ '{ print $NF }'`
>   echo "Trying to process file $PROCESS_FILE";
>   if [ -e "$FLUSH_DIR/${PROCESS_FILE}.flushes" ]
>   then
>         echo "File with same name has been processed" | mail

>   else
>   cd $SCRIPT_DIR/dbload;
>   $JAVA_HOME/bin/java -classpath $JAVA_LIBS:$SCRIPT_DIR/dbload
> VisteonDBLoad -f $1 2>&1 | mail kp

>   if [ -e "$1.flushes" ]
>    then
>         mv $1.flushes $SCRIPT_DIR/dbload/flushes
>   fi
>   fi
> fi

> -- END

> I guess it is failing on  'if [ -e
> "$FLUSH_DIR/${PROCESS_FILE}.flushes" ]' with error test: argument
> expected. What am I doing wrong here?

    Does your shell support the -e operator to test?

    Try using -f instead.

--
    Chris F.A. Johnson                        http://cfaj.freeshell.org
    ===================================================================
    My code (if any) in this post is copyright 2002, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License

 
 
 

Help me with this error message : test: argument expected

Post by Barry Margoli » Sat, 14 Sep 2002 06:58:46




>I guess it is failing on  'if [ -e
>"$FLUSH_DIR/${PROCESS_FILE}.flushes" ]' with error test: argument
>expected. What am I doing wrong here?

If you're not even sure which test is complaining, perhaps you should put
"set -x" at the top of the script.  This will make the shell display all
the commands with variables expanded before executing them.

--

Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. Argument expected error from test

I don't see what I'm doing wrong here. Any idea why this would return
an "Argument expected" error from test. If I pass two or more
variables, it works. If I only pass one, it gives the error. It looks
to me as if it should work with one variable, so long as that variable
is not "-bk" or "-BK". I'll build in some error checking to work
around that, but for now I'm perplexed.

if [ "$1" = "-bk" -o "$1" = "-BK" ]
then
  BACKUP=1
  shift
fi


do
  if [ $BACKUP -eq 1 ]
  then
    copy -ovrm $i $i.bak >/dev/null
  fi
  RXFILE $i $i
  case $i in
    SS*) dtox $i >$i.$$
         mv $i.$$ $i
         chmod 777 $i ;;
    *)   ;;
  esac
done

2. xhosting

3. test: argument expected error

4. HELP: "Math emulation, kernal panic", system halted

5. test test test test test test test

6. minimum config axppci33

7. comps 0.1 expected error message when trying to install

8. Problem with link() Help!

9. Mouse error message " ... fd (Invalid Argument)

10. ERROR MESSAGE: accept:Invalid Argument

11. 'SIOCADDRT: Invalid argument' error message at boot time

12. Error message continuous error messages

13. how to pass this argument to Expect ?