title: When using PowerShell on Linux, is there a way to set the shell $PWD on exit of the PS script?
body: <p>When running a PowerShell script from bash, is there a way to have PowerShell set the current directory of the calling shell up exit?</p>
  <p>I have tried the following things (independently, not all at once)</p>
  <pre><code>#!/usr/bin/env pwsh 
  # myscript.ps1
  
  $desiredPath = &quot;/the/path/I/Want&quot;
  &amp; cd $desiredPath
  &amp; Set-Location $desiredPath
  &amp; zsh -c 'cd ${clonePath}'
  </code></pre>
  <p>Unfortunately, the end result always ends up being back at the prior <code>$PWD</code>.</p>
  <p>I am sure I could return the path from the script and then pipe it to another command, but I am trying to find out if there is a way to accomplish this without having to do that, as I have the scripts folder on my path so I can simply call <code>myscript.ps1 arg1 arg2</code>.</p>