Is there a way for me to implement custom fake signals in ksh? Currently am capturing the ERR signal and exiting. However, due to a change, there are calls that may not return success, however that is a valid condition. In such case, I want to make sure that this call generates a different signal or handle the ERR differently. Is there a way to do that?
You can use
kill
to send any signal you want to the current shell. You can useexit
in a subshell orreturn
in a function to set any error code you want.Try this script:
Example: