From 29e43d9e31ba3bb593a11b40dc4adf33256539e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Fri, 11 Sep 2020 09:21:07 +0200 Subject: [PATCH] add functions to change debug --- bashrc_add | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/bashrc_add b/bashrc_add index ee28454..81e954c 100755 --- a/bashrc_add +++ b/bashrc_add @@ -2,8 +2,31 @@ #debug # set SSHS to false, if not set -if [ -z ${SSHS+x} ]; then SSHS=false;fi -if [ -z ${MYSHELLCONFIG_DEBUG+x} ]; then MYSHELLCONFIG_DEBUG=false;fi +if [ -z ${SSHS+x} ]; then export SSHS=false;fi + +# define debug default +MYSHELLCONFIG_DEBUG_DEFAULT=false +# set debug to default, if not set +if [ -z ${MYSHELLCONFIG_DEBUG+x} ]; then export MYSHELLCONFIG_DEBUG=$MYSHELLCONFIG_DEBUG_DEFAULT;fi + +turnondebug() { + change_debug true +} + +turnoffdebug() { + change_debug false +} + +change_debug () { + if $1; then + echo turn ON debug myshellconfig + export MYSHELLCONFIG_DEBUG=true + else + echo turn OFF debug myshellconfig + export MYSHELLCONFIG_DEBUG=false + fi +} + # check if we are a interactive shell # https://guide.bash.academy/expansions/