Skip to content

Commit

Permalink
Improve handling exit scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
verovaleros committed Jul 25, 2024
1 parent b0fa5cf commit c982094
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions cleaning/zeek_purge_ip_from_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ usage() {

# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
command -v "$1" >/dev/null 2>&1 || { echo "Error: $1 is not installed."; exit 1; }
}

# Function to validate IP address format
Expand Down Expand Up @@ -92,10 +92,7 @@ validate_ip "$IP_TO_REMOVE"

# Check required commands
for cmd in find zcat grep gzip mktemp mv cp; do
if ! command_exists "$cmd"; then
echo "Command not found: $cmd"
exit 1
fi
command_exists "$cmd"
done

# Check write permissions
Expand Down

0 comments on commit c982094

Please sign in to comment.