mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-24 15:43:24 +08:00
修改重置环境变量逻辑
This commit is contained in:
parent
8760ac2964
commit
899a30eacd
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
store_env_vars() {
|
store_env_vars() {
|
||||||
initial_vars=($(compgen -A variable))
|
initial_vars=($(env | cut -d= -f1))
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_env_vars() {
|
restore_env_vars() {
|
||||||
for key in $(compgen -A variable); do
|
for key in $(env | cut -d= -f1); do
|
||||||
if ! [[ " ${initial_vars[@]} " =~ " $key " ]]; then
|
if ! [[ " ${initial_vars[@]} " =~ " $key " ]]; then
|
||||||
unset "$key"
|
unset "$key"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user