【发布时间】:2014-06-20 01:17:20
【问题描述】:
问题:我无法使用绝对路径运行 perl 脚本。我可以用相同的路径列出它,但只能在使用相对路径时执行!
我的 Cygwin 终端的输出会让这个问题很明显
在这里我尝试使用绝对路径执行脚本 - 它失败了:
LPI@Reboot /cygdrive/c/Users
$ /cygdrive/c/Users/LPI/3DSiteSoftware/Code/Scripts/path_name.pl
Can't open perl script "/cygdrive/c/Users/LPI/3DSiteSoftware/Code/Scripts/path_name.pl": No such file or directory
在这里我使用相同的绝对路径列出它 - 它有效,文件在那里:
LPI@Reboot /cygdrive/c/Users
$ ls /cygdrive/c/Users/LPI/3DSiteSoftware/Code/Scripts/path_name.pl
/cygdrive/c/Users/LPI/3DSiteSoftware/Code/Scripts/path_name.pl
在这里,我尝试使用相对于我当前目录 /cygdrive/c/Users 的路径执行它:
LPI@Reboot /cygdrive/c/Users
$ LPI/3DSiteSoftware/Code/Scripts/path_name.pl
USAGE: LPI/3DSiteSoftware/Code/Scripts/path_name.pl -p|-n <string>
有谁知道为什么第一个示例不起作用?我快被难住了! 感谢您的建议。
【问题讨论】:
-
ls -l /cygdrive/c/Users/LPI/3DSiteSoftware/Code/Scripts/path_name.pl返回什么? -
head -n 1 LPI/3DSiteSoftware/Code/Scripts/path_name.pl的输出是什么?