title: How can I "cache" the effects of Intel OneAPI setvars?
body: <p>Intel's OneAPI distribution (which includes many components such as ICC) has a script named <code>setvars.sh</code>, which checks for the presence of various stuff, then runs components' individual scripts for setting environment variables. It takes over a second to run and prints some stuff to the terminal.</p>
  <p>Now, I'm willing to run it <em>once</em>, but I certainly don't want to run it whenever I start a shell. How can I &quot;cache&quot; its results, in the form of the delta it adds (or removes?) from my environment before its invocation? So that I could just source a script with:</p>
  <pre><code>export PATH=&quot;whatever:$PATH&quot;
  export TBBROOT=&quot;whatever&quot;
  # etc. etc.
  </code></pre>
  <p>?</p>
  <p>Naturally, I would need to re-run setvars.sh if my system configuration changed in any way, but I'm ok with that.</p>
  <hr />
  <p>PS - It has to be said: OneAPI is the epitome of mis-naming. It's the never-going-to-be-used-by-anybody-other-than-us, one-of-many API.</p>