set -e oddity

Edgar Fuß <[email protected]> Sat, 24 Jan 2026 19:24:16 +0100
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <aXUOUKy/[email protected]>
Is it expected behaviour that x is still 1 in the EXIT trap?

#!/bin/sh

set -e

trap 'echo $x' EXIT

x=0

f() {
	false
}

x=1 f
~