mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
修改重置环境变量逻辑
This commit is contained in:
parent
8760ac2964
commit
899a30eacd
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user