trap-event

RETURN

Run when a function or sourced script finishes in a traced context. Not a failure notification; inheritance can be enabled by functrace.

Formal Syntax & Structure

bash syntaxbash
trap action RETURN

Return Value

event

Run when a function or sourced script finishes in a traced context. Not a failure notification; inheritance can be enabled by functrace.

Working Example

Example Snippetbash
work() { printf 'work\n'; }trap 'printf "returned\n" >&2' RETURNset +Tworkset -Tworktrap - RETURNwork
Bash Reference