#!/bin/bash # Define the log file to search log_file="/var/log/syslog" # Define the error keyword to search for error_keyword="ERROR" # Should return the line(s) with ERROR in them. grep -n "$error_keyword" "$log_file"