【问题标题】:How to compare the content of two files in EFI Shell如何在 EFI Shell 中比较两个文件的内容
【发布时间】:2020-12-28 00:25:19
【问题描述】:

我想比较 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

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

【问题讨论】:

  • 有个comp命令,不知道能不能用在if中。也许通过使用 %lasterror%?

标签: shell uefi


【解决方案1】:

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

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

%lasterror% 相当于 .bat 脚本中的 %errorlevel% 或 bourne shell 和衍生工具中的 $?

【讨论】:

    【解决方案2】:
    comp lan-text lan-ref.txt 
    if %lasterror% ==0 then 
      reset
    else
       echo "LAN not found"
    endif
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-26
      • 2020-01-31
      • 2021-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多