This is my code:
function my::return() {
exit_code="$1"
echo "exit status of last command: ${exit_code}"
}
function testing(){
trap 'my::return $?' RETURN
return 2
}
If I run testing I expect the exit_code to be 2 as tyhis is the code in the return thaat the trap catches.