Is there an equivalent of -e that works inside bash functions, and returns instead of exiting? Here is an example:
#! /usr/bin/env bash
set -e
function test1() {
echo A
ls alskdfal
echo B
}
test1 || echo C
Right now I get the following output
A
ls: cannot access 'alskdfal': No such file or directory
B
It continues past that error even thought I have set -e. I am looking for a way to get the following, without puttin | return 1 after each line.
A
ls: cannot access 'alskdfal': No such file or directory
C