如何在EFI Shell中比较两个文件的内容

问题描述

我想比较EFI Shell中两个文件内容。 我将 pci 05 00 00 内容保存在lan-ref.txt

我的脚本如下:

echo -off
fs0:

pci 05 00 00 -s 0 > lan.txt

if lan.txt == lan-ref.txt then
  reset
else
  echo "LAN not found"
endif

我知道“如果lan.txt == lan-ref.txt”不起作用,我正在寻找实现所需功能的正确行。

解决方法

就像@prl建议的那样,结合使用comp命令和%lasterror%

comp lan-text lan-ref.txt
if %lasterror% eq 0 then
  reset
else
  echo "LAN not found"
endif

%lasterror%等效于.bat脚本中的%errorlevel%或本恩shell和衍生产品中的$?

,
comp lan-text lan-ref.txt 
if %lasterror% ==0 then 
  reset
else
   echo "LAN not found"
endif