Apparently, you can't do this "running" a script. As its enviroment is lost when returning to your shell.
But, not "running" it but just "reading/loading" it would be a good way to do what you want.
The variable PWD represents the presently working directory (where you last used cd to, you might try it by "echo $PWD" which will return your current directory). So instead of
You could,
Code:
"export PWD=/somewhere"
(replace that on the script).
And instead of running the script using
You should use source,
This will load its enviroment(retain all the variables used in the script), so your current directory will change to the one selected in the script.