From 899a30eacdf24c4fa4621c9ffaafe8ec0efefee3 Mon Sep 17 00:00:00 2001 From: whyour Date: Mon, 30 Oct 2023 15:04:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E7=BD=AE=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/env.sh b/shell/env.sh index 4d7dcff7..bc93c45e 100644 --- a/shell/env.sh +++ b/shell/env.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash store_env_vars() { - initial_vars=($(compgen -A variable)) + initial_vars=($(env | cut -d= -f1)) } restore_env_vars() { - for key in $(compgen -A variable); do + for key in $(env | cut -d= -f1); do if ! [[ " ${initial_vars[@]} " =~ " $key " ]]; then unset "$key" fi