From a3bdecb10bd6d27d040d10ac9255d99b86d630df Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 20 Jan 2023 13:45:11 +0100 Subject: [PATCH] helper: add start-bash-session.sh --- helper/start-bash-session.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 helper/start-bash-session.sh diff --git a/helper/start-bash-session.sh b/helper/start-bash-session.sh new file mode 100644 index 0000000..f4fa67d --- /dev/null +++ b/helper/start-bash-session.sh @@ -0,0 +1,12 @@ +# Start an interactive bash session in the current bash environment. +# This is helpful for debugging bash scripts like pkg update scripts, +# by adding `source /start-bash-session.sh` at the location to +# be inspected. + + +# BASH_ENVIRONMENT contains definitions of read-only variables like 'BASHOPTS' that +# cause warnings on evaluation. Suppress these warnings while sourcing. +# +# shellcheck disable=SC2016 +BASH_ENVIRONMENT=<(declare -p; declare -pf) \ + bash --rcfile <(echo 'source $BASH_ENVIRONMENT 2>/dev/null')