Add a comment before each line of this Bash script explaining what it's doing:
while true; do
  cpu_usage=$(ps -o %cpu -p $(pgrep $process_name) --no-headers)
  if [[ $(echo "$cpu_usage>$cpu_threshold" | bc) -eq 1 ]]; then
    notify-send "CPU Alert" "$process_name is using more than $cpu_threshold% CPU"
  fi
  sleep 1m
done
system
Add a comment before each line of this Bash script explaining what it's doing:
while true; do
  cpu_usage=$(ps -o %cpu -p $(pgrep $process_name) --no-headers)
  if [[ $(echo "$cpu_usage>$cpu_threshold" | bc) -eq 1 ]]; then
    notify-send "CPU Alert" "$process_name is using more than $cpu_threshold% CPU"
  fi
  sleep 1m
done
user
Here is the script with a comment before each line to explain it:

# Repeat infinitely.
while true; do
  # Set the variable cpu_usage to the process' CPU usage.
  cpu_usage=$(ps -o %cpu -p $(pgrep $process_name) --no-headers)
  # Check if the CPU usage is greater than the CPU threshold.
  if [[ $(echo "$cpu_usage>$cpu_threshold" | bc) -eq 1 ]]; then
    # Send a notification titled "CPU Alert" to inform the user of the process' high CPU usage.
    notify-send "CPU Alert" "$process_name is using more than $cpu_threshold% CPU"
  fi
  # Wait 1 minute before repeating.
  sleep 1m
done
assistant
<|system|>
</s>
<|user|>
Add a comment before each line of this Bash script explaining what it's doing:
while true; do
  cpu_usage=$(ps -o %cpu -p $(pgrep $process_name) --no-headers)
  if [[ $(echo "$cpu_usage>$cpu_threshold" | bc) -eq 1 ]]; then
    notify-send "CPU Alert" "$process_name is using more than $cpu_threshold% CPU"
  fi
  sleep 1m
done</s>
<|assistant|>
Here is the script with a comment before each line to explain it:

# Repeat infinitely.
while true; do
  # Set the variable cpu_usage to the process' CPU usage.
  cpu_usage=$(ps -o %cpu -p $(pgrep $process_name) --no-headers)
  # Check if the CPU usage is greater than the CPU threshold.
  if [[ $(echo "$cpu_usage>$cpu_threshold" | bc) -eq 1 ]]; then
    # Send a notification titled "CPU Alert" to inform the user of the process' high CPU usage.
    notify-send "CPU Alert" "$process_name is using more than $cpu_threshold% CPU"
  fi
  # Wait 1 minute before repeating.
  sleep 1m
done</s>
