My script
#!/bin/bash
set -eu
usrFile="${1}"
while read -r usrCMD
do exec -e "${usrCMD}" || echo_fun "${usrCMD}"
done < "$usrFile"
echo_fun is a function that prints the message.
In the echo_fun, I want to pass the error message of command exec -e "${usrCMD}"
Is this possible?