dylanaraps / pure-bash-bible

📖 A collection of pure bash alternatives to external processes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add example debug script with trap

vay3t opened this issue · comments

commented

debug script with trap

  • Example:
function exit_trap() {
        local lc="$BASH_COMMAND" rc=$?
        echo "Command [$lc] exited with code [$rc]"
}

trap exit_trap err