我似乎无法弄清楚为什么在尝试运行我的 .pl 脚本时会出现此错误。
这是脚本:
# mini script for creating diff files in a single directory
# directory of patch files
$patchDir = "c:\oc\Patch Files";
if ($#ARGV != 1 && $#ARGV != 2)
{
print "Usage: diff <file name> [-s]\n";
print "Example: \n";
print " |Diff relative to Index (staged)| : diff MOM00123456_1.patch \n";
print " |Diff Staged| : diff MOM00123456_1.patch -s \n";
exit;
}
$fileName = $ARGV[0];
if ($#ARGV == 2)
$stagedArg = $ARGV[1];
if ($stagedArg)
if ($stagedArg == "-s" || $stagedArg == "-S")
system("git diff --staged --full-index > $fileName $patchDir");
else
{
print "Unknown argument: $stagedArg\n";
exit;
}
else
system("git diff --full-index > $fileName $patchDir");
测试:
diff.pl test.patch -s
输出:
标量在 C:\utils\diff.pl 第 18 行附近的运算符预期位置找到
")
$stagedArg"
(在 $stagedArg 之前缺少运算符?) C:\utils\diff.pl 第 18 行,“附近”的语法错误)
$stagedArg " C:\utils\diff.pl 第 21 行的语法错误,靠近 ")
如果” C:\utils\diff.pl 的执行由于编译错误而中止。
由于编译错误,C:\utils\diff.pl 的执行中止。
有人可以阐明一下吗?