Bash – Perl script, do cd on terminal

bashcd-commandperlterminal

In Script to change current directory (cd, pwd)
it is shown how to run a bash script that changes terminal directory.

But how do i run a perl script that runs a bash script that changes terminal directory?

Best Answer

You can't.

The Perl script runs in a process which is a child of your shell session. This child process can change its own working directory all it likes, but it cannot change it's parent's working directory. When the Perl script exits, control is returned to the parent process (the shell session), which will have remained in the same working directory the whole time, regardless of what the child process did while it was running.

Related Question