0

I'm trying to implement real time scanning on cPanel server.

When I use the following script,

#!/bin/bash
#Maximum file size to scan in bytes that's set to 10MB
MAXSIZE=10485760
if [ "$UPLOAD_SIZE" -le "$MAXSIZE" ]; then
/usr/bin/clamdscan --remove --quiet --no-summary "$1"
fi

Output shows,

line 4: [: : integer expression expected
1
  • 2
    Bash has ((...)) for arithmetics. Use if ((upload_size < maxsize)); then ...; fi Also don't use UPPERCASE for normal variable names. Jul 14, 2017 at 10:13

1 Answer 1

2

Looks to me like your $UPLOAD_SIZE is unset (or empty or non-numeric), that's why you get an error. What you probably want is declaring it before comparing if it is lesser than something, which you haven't done.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .