Sorry, if FPATH is exported then it is inherited by the child
zsh even if it is started with option -f. So the above will not work.
You can check whether FPATH is exported of not by
If it shows 'export ...' then it is exported. You can 'un-export' it
Sorry, as soon as I saw "if FPATH is exported" I figured out what was happening.
My .zshrc file makes sure FPATH is exported. This is because some scripts/functions I
wrote failed if FPATH wasn't exported. So, I export it all the time. I didn't consider what
this would do when switching shells.
I now have the following aliases:
alias swshell='[[ $parameters[FPATH] == *export* ]] && typeset +x FPATH ; '
alias xportfpath='[[ $parameters[FPATH] == *export* ]] || typeset -x FPATH'
Solved. Sorry for the noise.
Thanks for you response,
Jim