From 5b8333e808ebae11defae1d387fcf32c25305a20 Mon Sep 17 00:00:00 2001 From: Dan Bornstein Date: Mon, 6 Nov 2023 15:39:46 -0800 Subject: [PATCH] Add `env-minimize`. --- CHANGELOG.md | 3 ++- scripts/lib/bashy-basics/_setup.sh | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba4b4f8..5b79de8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ Breaking changes: * None. Other notable changes: -* `bashy-basics`: New utility functions `env-clean` and `env-names`. +* `bashy-basics`: New utility functions `env-clean`, `env-minimize`, and + `env-names`. ### v2.7 -- 2023-10-30 diff --git a/scripts/lib/bashy-basics/_setup.sh b/scripts/lib/bashy-basics/_setup.sh index 3c132d8..4a8356b 100644 --- a/scripts/lib/bashy-basics/_setup.sh +++ b/scripts/lib/bashy-basics/_setup.sh @@ -79,6 +79,12 @@ function env-clean { done } +# Runs `env-clean` passing it a reasonably "minimal" set of environment +# variables to keep. +function env-minimize { + env-clean HOME HOSTNAME LANG LOGNAME PATH PWD SHELL SHLVL TERM TMPDIR USER +} + # Prints a list of the names of all defined environment variables. function env-names { # It turns out that the most straightforward way to get a list of