Skip to main content
3 of 5
deleted 96 characters in body
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Your script is triggering the ERR trap due to the return status of the control_operators call, which is non-zero. The test in the function does not directly trigger the trap.

The trap output indicates this by the line number it prints, which will be the line with the call to the function.

The trap output also indicates where this non-zero exit status comes from, which is the result of the test in the function. Since the test is the last thing executed in the function, this sets the function's exit status.

The function call is not part of an AND or OR list, so the trap is triggered.

Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k