"env -" segfaults

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Thu Nov 12 14:54:25 UTC 2009


On Thu, Nov 12, 2009 at 03:09:12PM +0100, Bernd Petrovitsch wrote:
>On Thu, 2009-11-12 at 16:57 +0300, Vladimir Dronnikov wrote:
>> >
>> > Using export -n or unset?
>> >
>> 
>> I need command to effectively perform clearenv(), to unset all vars at
>> once ( that's why I tried "env -" :). Is there such in the nature?
>No, no one really wants to delete/unexport *all* environment variables
>as that includes $HOME and $PATH (to name 2 that come immediately to my
>mind).
>FWIW
>---- snip  ----
>unset $(env | sed -e 's/=.*//')
>---- snip  ----
>does the trick (in a bash). Similar should be doable for other shells.

env | cut -d'=' -f1 | while read i;do unset $i;done


More information about the busybox mailing list