BASH_ENV causes all non-interactive shells called via eg. /etc/bashrc to remove the rc-file before the main shell gets to run it. Completion scripts will often do this. Fixes #976. Adapted from and fixes #1034.
An equivalent was originally filed against the perl version: https://github.com/NixOS/nix/pull/933
This was a dumb line-for-line rewrite, because nix build/nix run/etc. will replace it.