diff --git a/lib/domain-discovery.sh b/lib/domain-discovery.sh index 43a2ebf..fbf649c 100644 --- a/lib/domain-discovery.sh +++ b/lib/domain-discovery.sh @@ -38,7 +38,7 @@ list_all_domains() { else # Fallback: scan /var/cpanel/users/ for user_file in /var/cpanel/users/*; do - [ -f "$user_file" ] && grep "^DNS=" "$user_file" | cut -d'=' -f2 + [ -f "$user_file" ] && grep "^DNS=" -- "$user_file" | cut -d'=' -f2 done | sort -u fi ;; diff --git a/lib/email-functions.sh b/lib/email-functions.sh index 9ad84cf..6a4458d 100755 --- a/lib/email-functions.sh +++ b/lib/email-functions.sh @@ -274,12 +274,12 @@ count_by_sender() { local min_date="${2:-}" if [ -n "$min_date" ]; then - awk -v min_date="$min_date" '$0 >= min_date' "$log_file" | \ + awk -v min_date="$min_date" '$0 >= min_date' -- "$log_file" | \ grep "<=" | \ grep -oE '\<[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\>' | \ sort | uniq -c | sort -rn else - grep "<=" "$log_file" | \ + grep "<=" -- "$log_file" | \ grep -oE '\<[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\>' | \ sort | uniq -c | sort -rn fi diff --git a/lib/php-config-manager.sh b/lib/php-config-manager.sh index cb1c95d..f365ca4 100644 --- a/lib/php-config-manager.sh +++ b/lib/php-config-manager.sh @@ -166,9 +166,9 @@ list_backups() { local metadata_file="$backup_dir/metadata.txt" if [ -f "$metadata_file" ]; then - local created=$(grep "^Backup Created:" "$metadata_file" | cut -d: -f2- | xargs) - local username=$(grep "^Username:" "$metadata_file" | cut -d: -f2 | xargs) - local domain=$(grep "^Domain:" "$metadata_file" | cut -d: -f2 | xargs) + local created=$(grep "^Backup Created:" -- "$metadata_file" | cut -d: -f2- | xargs) + local username=$(grep "^Username:" -- "$metadata_file" | cut -d: -f2 | xargs) + local domain=$(grep "^Domain:" -- "$metadata_file" | cut -d: -f2 | xargs) local file_count=$(find "$backup_dir" -type f ! -name "metadata.txt" | wc -l) echo "$backup_name|$created|$username|$domain|$file_count" diff --git a/lib/php-detector.sh b/lib/php-detector.sh index d20f4fa..7a288be 100644 --- a/lib/php-detector.sh +++ b/lib/php-detector.sh @@ -68,7 +68,7 @@ detect_php_version_for_domain() { # Check userdata for PHP version local userdata_file="${SYS_CPANEL_USERDATA_DIR:-/var/cpanel/userdata}/$username/$domain" if [ -f "$userdata_file" ]; then - local php_ver=$(grep "phpversion:" "$userdata_file" | awk '{print $2}' | tr -d "'\"") + local php_ver=$(grep "phpversion:" -- "$userdata_file" | awk '{print $2}' | tr -d "'\"") echo "$php_ver" return 0 fi diff --git a/lib/reference-db.sh b/lib/reference-db.sh index 3314bc2..25a5ce2 100755 --- a/lib/reference-db.sh +++ b/lib/reference-db.sh @@ -292,7 +292,7 @@ build_domains_section() { local doc_root=$(grep "^documentroot:" -- "$config_file" | awk '{print $2}' || true) local log_path=$(grep "target:.*domlogs" -- "$config_file" | head -1 | awk '{print $2}' || true) local server_alias=$(grep "^serveralias:" -- "$config_file" | awk '{print $2}' || true) - local php_version=$(grep "^phpversion:" "$config_file" | awk '{print $2}' || true) + local php_version=$(grep "^phpversion:" -- "$config_file" | awk '{print $2}' || true) # Determine if primary domain local is_primary="no" diff --git a/lib/user-manager.sh b/lib/user-manager.sh index 7d60317..a255d99 100755 --- a/lib/user-manager.sh +++ b/lib/user-manager.sh @@ -131,7 +131,7 @@ get_cpanel_user_info() { local home_dir="/home/${username}" # Get addon/parked domains - local all_domains=$(grep "^DNS" "$user_file" | cut -d= -f2 | tr '\n' ' ') + local all_domains=$(grep "^DNS" -- "$user_file" | cut -d= -f2 | tr '\n' ' ') # Get disk usage local disk_used=$(du -sh "$home_dir" 2>/dev/null | awk '{print $1}')