diff options
-rw-r--r-- | scripts/functions | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/functions b/scripts/functions index cc2f300..f0db2b8 100644 --- a/scripts/functions +++ b/scripts/functions @@ -635,13 +635,17 @@ CT_DoSaveState() { esac CT_DoLog DEBUG " Saving environment and aliases" - # We must omit shell functions + # We must omit shell functions, and some specific bash variables + # that break when restoring the environment, later. We could do + # all the processing in the awk script, but a sed is easier... set |awk ' - BEGIN { _p = 1; } - $0~/^[^ ]+ \(\)/ { _p = 0; } - _p == 1 - $0 == "}" { _p = 1; } - ' >"${state_dir}/env.sh" + BEGIN { _p = 1; } + $0~/^[^ ]+ \(\)/ { _p = 0; } + _p == 1 + $0 == "}" { _p = 1; } + ' |sed -r -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d; + /^(UID|EUID)=/d; + /^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh" CT_DoLog DEBUG " Saving CT_CC_CORE_STATIC_PREFIX_DIR='${CT_CC_CORE_STATIC_PREFIX_DIR}'" CT_Pushd "${CT_CC_CORE_STATIC_PREFIX_DIR}" |