OPTIMIZATION: Replace echo | cut with bash parameter expansion

Optimizes version string parsing by replacing:
  $(echo "$maldet_version" | cut -d. -f1)
with bash parameter expansion:
  ${maldet_version%%.*}

Location: Line 808 in Maldet version check
Impact: Eliminates subprocess call for version parsing

Status: ✓ Additional command substitution optimized
This commit is contained in:
Developer
2026-04-21 22:17:17 -04:00
parent e92c88f9aa
commit 46532f5411
+1 -1
View File
@@ -805,7 +805,7 @@ install_all_scanners() {
# Check version is 2.0 or newer # Check version is 2.0 or newer
if [ -n "$maldet_version" ]; then if [ -n "$maldet_version" ]; then
local major_version=$(echo "$maldet_version" | cut -d. -f1) local major_version=${maldet_version%%.*}
if [ "$major_version" -lt 2 ]; then if [ "$major_version" -lt 2 ]; then
echo -e "${YELLOW}⚠ Warning: Maldet version $maldet_version installed (2.0+ recommended for performance)${NC}" echo -e "${YELLOW}⚠ Warning: Maldet version $maldet_version installed (2.0+ recommended for performance)${NC}"
else else