Closed ram535 closed 3 years ago
You can probably do this now.
The env global variable is a map.
Just iterator over the map and set the value of each key to null.
We could possibly add a method Env().clearall()
On Thu, 22 Apr 2021, 1:26 pm Ramses, @.***> wrote:
I was reading a bash script for installing gcc. The script has this section.
======================================================================
Clean environment
======================================================================
Before beginning the configuration and build, clean the current shell of all
environment variables, and set only the minimum that should be required. This
prevents all sorts of unintended interactions between environment variables
and the build process.
store USER, HOME and then completely clear environment
U=$USER H=$HOME
for i in $(env | awk -F"=" '{print $1}') ; do unset $i || true # ignore unset fails done
restore
export USER=$U export HOME=$H export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin
echo shell environment follows: env .. . ..
setting some environment variables
Do you think this could be a good feature?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bsutton/dcli/issues/133, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG32OC2HNNONPOMO5D2XHDTJ6JN5ANCNFSM43LSHTGA .
As you can already do this via interaction with the envs variable in dcli I don't the method adds much value.
I was reading a bash script for installing gcc. The script has this section.
Do you think this could be a good feature?