Are there any elegant ways to write bash functions in .bashrc/.bash_profile which return as soon as a command returns error?
I have been using this format for some time but I was wondering if there are better ways as having || return 1 on every line doesn't look great.
function doCommands() {
    command1 || return 1 # return if command1 returns error
    command2 || return 1
    command3 || return 1
}
Thank you.
