Redirect stderr of wc to /dev/null due to vanished files.

This commit is contained in:
Benoît S. 2015-03-17 16:38:45 +01:00
parent 784e17c0c9
commit 077359976a

View file

@ -65,7 +65,7 @@ while read file; do
elif [[ "$file" =~ "wp-content/uploads/" ]]; then
echo "PHP file in a non-PHP folder detected: $file"
# Count the length of the longest line and search if suspect php functions are used.
elif [[ $($wc -L "$file" | cut -d' ' -f1) -gt 10000 ]]; then
elif [[ $($wc -L "$file" 2>/dev/null | cut -d' ' -f1) -gt 10000 ]]; then
grep -q -E "$suspect" "$file"
if [[ $? -eq 0 ]]; then
echo "Suspect file! More than 10000 characters in one line (and suspect PHP functions): $file."
@ -104,4 +104,4 @@ if ( $aggressive ); then
$grep -r 'eval(' .
$grep -r '\x..\x..' .
$grep -r 'chr(rand(' .
fi
fi