79131528

Date: 2024-10-27 21:30:41
Score: 1
Natty:
Report link

@xdhmoore, this question in your comment indeed works, as well as @Weekend suggestion.

Look at the snippet:

#!/bin/zsh

err_handler() {
    echo error at $funcfiletrace[1]
}
trap err_handler ZERR

myfunc() {
   (( 1/0 ))
}

myfunc

It will produce:

myfunc:1: division by zero
error at ./test:9

Line 9 contains (( 1/0 )) statement which rises the error.

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @Weekend
  • Low reputation (0.5):
Posted by: Alek