I'm trying to create some error reporting using a Trap to call a function on all errors:
Trap "_func" ERR
Is it possible to get what line the ERR signal was sent from? The shell is bash.
If I do that, I can read and report what command was used and log/perform some actions.
Or maybe I'm going at this all wrong?
I tested with the following:
#!/bin/bash trap "ECHO $LINENO" ERR echo hello | grep "asdf"
$LINENO is returning 2. Not working.