tools: export.sh: better detection and checking of IDF_PATH
tools: export.sh: better detection and checking of IDF_PATH

1. detect IDF_PATH in zsh, if it is not set
2. if IDF_PATH is set, check that it is valid
3. make sure IDF_PATH is exported, not just set

Related to https://github.com/espressif/esp-idf/issues/3793
Closes https://github.com/espressif/esp-idf/pull/4418
Closes https://github.com/espressif/esp-idf/issues/4770

espressif/esp-idf,espressif/esp-idf,espressif/esp-idf,espressif/esp-idf