Perl chdir 不起作用 [英] Perl chdir doesn't work

查看:30
本文介绍了Perl chdir 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前的帖子可能有用:Perl 系统() 调用失败,返回码 65280

同样,我已经多次使用此代码,但在这里不起作用.我已经从 PATH 中移动了所有其他 perl 实例.

Again, I've used this code many times, but it doesn't work here. I've moved all other perl instances from PATH.

来源:

$targetDir = "M\:\\bldforge_AOMS_DEV";
print ("targetDir=$targetDir\n");

chdir($targetDir) or die "Cant chdir to $dir $!";
$current_dir = `cd`;
print "\nCurrent dir = $current_dir\n" 

输出:

Z:\>ccperl test.pl
targetDir=M:\bldforge_AOMS_DEV

Current dir =

推荐答案

为了确保您确实处于 ClearCase 视图中,我将使用 cleartool pwd:

To be sure you are indeed in a ClearCase view, I would use cleartool pwd:

$current_dir = `cleartool pwd`;

即使在 Windows 上也能工作:

That will work even on Windows:

cleartool pwd 命令列出当前工作目录.
此命令旨在用于交互式 cleartool 和 multitool 会话,以及模拟交互式会话的批处理文件或 shell 脚本.

The cleartool pwd command lists the current working directory.
This command is intended for use in interactive cleartool and multitool sessions, and in batch files or shell scripts that simulate interactive sessions.

这篇关于Perl chdir 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆