本文介绍了Perl 更改调用者的工作目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想编写一个 perl 脚本,将其工作目录更改为其他位置,执行某些操作,然后在我从 shell 调用它后将我留在该目录中.chdir 只做第一部分.如何更改调用者的工作目录?

I want to write a perl script that changes its working directory to somewhere else, does something, and then leaves me in that directory after I call it from the shell. chdir only does the first part. How do I change the working directory of the caller?

推荐答案

你想做的事情是不可能的.最接近的事情是编写一些 bash 来执行您想要的操作,然后在调用 shell 中获取它而不是运行它.软件不能影响调用它的外壳.

What you want to do is not possible. The closest thing would be to write some bash that does what you want and then in the calling shell, source it instead of running it. Software cannot affect the shell that calls it.

这篇关于Perl 更改调用者的工作目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 02:31