A simpler duplication shows the issue is below. It appears the issue is is not related to the "for loop" - it can be duplicated just writing code inside the eshell { .. } block. To duplicate, please create a file ccc.el.gz - something the gzip does not fail on. Then, On the eshell prompt, enter the following code: $ export aaa="This is contents of aaa" { # create a variable in this block export bbb=$aaa; echo "Before gzip: aaa=$aaa" echo "Before gzip: bbb=$bbb"; gzip --decompress ccc.el.gz; echo "After gzip: aaa=$aaa" echo "After gzip: bbb=$bbb"; } Before gzip: aaa=This is contents of aaa Before gzip: bbb=This is contents of aaa After gzip: aaa=This is contents of aaa After gzip: bbb=nil $ Same bug: After the call to non-elisp program, /usr/bin/gzip, a previously exported variable bbb (exported inside the block) is nullified. Thanks