I wanted to make zsh load
emulate sh -c '. ~/.profile'
[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'
And it's only active during the source. So you do not have to save the current option state in order to replay it again after sourcing.
emulate sh -c 'source ~/.profile
[[ -e ~/.profile ]] simply tests whether the file
~/.profile exists. This way you won't get an error doing
source ~/.profile if the file isn't there.
"only active during the source" means that the
-c option that you give to the
emulate command doesn't change the options to the original shell process. It just uses that temporarily during the emulation of the