From 70267d89e562625a9c7b406796292daea8104cf9 Mon Sep 17 00:00:00 2001 From: Casper Date: Thu, 28 Jan 2021 14:50:28 +0100 Subject: [PATCH] Replace $_ in error trap (#1776) --- CONTRIBUTING.md | 2 +- setup.sh | 2 +- test/linting/lint.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d2c631c..1d881ac9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -121,7 +121,7 @@ A construct to trace error in your scripts looks like this. Remember: Remove `se ``` BASH set -xeuEo pipefail -trap '__log_err ${FUNCNAME[0]:-"?"} ${_:-"?"} ${LINENO:-"?"} ${?:-"?"}' ERR +trap '__log_err ${FUNCNAME[0]:-"?"} ${BASH_COMMAND:-"?"} ${LINENO:-"?"} ${?:-"?"}' ERR SCRIPT='name_of_this_script.sh' diff --git a/setup.sh b/setup.sh index a9e61b58..b19c5620 100755 --- a/setup.sh +++ b/setup.sh @@ -7,7 +7,7 @@ SCRIPT='setup.sh' set -euEo pipefail -trap '__log_err ${FUNCNAME[0]:-"?"} ${_:-"?"} ${LINENO:-"?"} ${?:-"?"}' ERR +trap '__log_err ${FUNCNAME[0]:-"?"} ${BASH_COMMAND:-"?"} ${LINENO:-"?"} ${?:-"?"}' ERR trap '_unset_vars || :' EXIT function __log_err diff --git a/test/linting/lint.sh b/test/linting/lint.sh index 0a221b48..35eb3892 100755 --- a/test/linting/lint.sh +++ b/test/linting/lint.sh @@ -24,7 +24,7 @@ _get_current_directory # ? ––––––––––––––––––––––––––––––––––––––––––––– ERRORS set -eEuo pipefail -trap '__log_err ${FUNCNAME[0]:-"?"} ${_:-"?"} ${LINENO:-"?"} ${?:-"?"}' ERR +trap '__log_err ${FUNCNAME[0]:-"?"} ${BASH_COMMAND:-"?"} ${LINENO:-"?"} ${?:-"?"}' ERR function __log_err {