-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
For bash -e, error in a function causes exit:
$ cat b
echo sub-bash pid: $$
function cd2 {
if cd "$@"; then
return 0;
else
return 1;
fi;
}
cd2 /fjfjfjfj
echo After cd2
$ echo $$
5566
$ bash -e < b
sub-bash pid: 33200
bash: line 3: cd: /fjfjfjfj: No such file or directory
$ echo $$
5566
$
For rc -e, error in a function does not cause exit (subsequent command false does cause exit):
$ cat r
echo sub-rc pid: $pid
fn cd3 {
if (cd $*) {
return 0
} else {
return 1
}
}
cd3 /jfjfjoei
echo After cd3
$
$ ../rc -e < r
sub-rc pid: 33238
rc: /jfjfjoei: No such file or directory
After cd3
$
I checked that the status after cd3 /jfjfjoei is correct (1).
Metadata
Metadata
Assignees
Labels
No labels