When running a PowerShell script from bash, is there a way to have PowerShell set the current directory of the calling shell up exit?
I have tried the following things (independently, not all at once)
#!/usr/bin/env pwsh
# myscript.ps1
$desiredPath = "/the/path/I/Want"
& cd $desiredPath
& Set-Location $desiredPath
& zsh -c 'cd ${clonePath}'
Unfortunately, the end result always ends up being back at the prior $PWD
.
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 myscript.ps1 arg1 arg2
.