Diff 输出“二进制文件 <file1> <file2> 不同”但不是通常的细节输出

Tra*_*iet 5 diff proc cat

我想比较两个文件——“orienv”和“currenv”,使用命令diff.

我创建这两个文件的方式如下:

  1. 创建“currenv”文件

    $cat /proc/1/environ >> currenv
    $cat /pcoc/279/environ >> currenv
    $cat /proc/295/environ >> currenv
    //295 is the pid of the current console
    
    Run Code Online (Sandbox Code Playgroud)
  2. 创建 orienv 文件

    $printenv > orienv
    
    Run Code Online (Sandbox Code Playgroud)

然后我打电话diff如下

diff -u orienv currenv
Run Code Online (Sandbox Code Playgroud)

并得到以下输出

二进制文件 orienv 和 currenv 不同

我期待diff带有标志的正常输出-u(例如,在输出中它显示了hunks的差异,指示哪个文件具有另一个文件没有的信息。

什么地方出了错?

Ipo*_*cer 1

/proc/*/environ 不是文本文件。使用字符串:

strings /proc/{1,279,295}/environ >> currenv
env > orienv
diff -u orienv currenv
Run Code Online (Sandbox Code Playgroud)