title: How to set PATH only in bash script temporarily?
body: <p>PATH can be set temporarily for following commands. Also, PATH can be set in a script, which remains permanently (in that terminal, or session). How can I set PATH that is globally effective in the script but not after the script finishes?</p>
  
  <p>Example:</p>
  
  <pre><code>PATH=$PATH:/path1 path1 is valid only for this line
  export PATH=$PATH:/path2
  path2 is valid for this line
  and this line too
  I like it
  
  exit
  
  &gt; path2 is still valid after the script finishes
  &gt; and when I type commands here manually
  &gt; I don't like it
  </code></pre>