Maybe you can write a function in ~/.zshrc, ~/.bashrc .
# set my env
[ -s ~/.env ] && export MYENV=`cat ~/.env`
function myenv() { [[ -s ~/.env ]] && echo $argv > ~/.env && export MYENV=$argv }
Beacause of use variable outside, you can avoid write script file.