#611

Add cmp

Openasafyishopened 14d ago

What are you trying to do?

Check in a script whether two files are identical, e.g. cmp -s a b && echo same. In just-bash 3.6.0 that's bash: cmp: command not found (exit 127).

Proposed behavior

The basic GNU cmp:

  • cmp a b prints a b differ: byte 1, line 1 at the first difference.
  • -s prints nothing.
  • -l lists the differing bytes.
  • Exit status is 0 when the files are identical, 1 when they differ, and 2 on trouble.

Alternatives

diff -q a b >/dev/null works for text files, but people and agents reach for cmp first and get 127.

Additional context

Our LLM agent tried cmp in an eval run and had to fall back to diff. Node 26 on macOS.

Activity

0

No activity yet.