If the goal is simply to run each function, and bail out of there was any errors, maybe something like this will work:
function bail {
echo "se ha producido un error ($1)"
exit 1
}
function a {
uptime
}
function b {
cat /etc/redhat-release
}
function c {
cat /etc/redhat-release
}
for f in 'a' 'b' 'c'; do
$f || bail "$f: $?"
done
This will run each function, and if an error is encountered, the function name and exit code are sent to the `bail` function, which will print a line and bail out of any additional commands.
I did remove the use of `su` because it was easier to test that way. If you want to automate this, I'd recommend creating a sudo profile to run those commands with elevated privileges in such a way that you only need to enter your password once, or no times at all.