【发布时间】:2023-03-17 18:42:01
【问题描述】:
我有一个包含 4 个 perl 命令的文件, 我想从 tcl 打开文件并执行每个 perl 命令。
TCL 脚本
runcmds $file
proc runcmds {file} {
set fileid [open $file "r"]
set options [read $fileid]
close $fileid
set options [split $options "\n"] #saperating each commad with new line
foreach line $options {
exec perl $line
}
}
执行上述脚本时
我收到的错误为"can't open the perl script /../../ : No Such file or directory " Use -S to search $PATH for it。
【问题讨论】:
-
总的来说,我觉得不错。如果我是你,我会尝试使用所有内容的完整路径:perl 二进制文件以及 $options 变量中可能出现的任何内容。