CMP(1plan9)

πŸ’– NAME πŸ’–

cmp β€” compare two files. That's the whole job, bestie, and she does it flawlessly. πŸ’…


🌸 SYNOPSIS 🌸

cmp [ -lsL ] file1 file2 [ offset1 [ offset2 ] ]

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so literally, the two files get compared. If the contents differ, you get a diagnostic. If they don't differ? No output at all. Silence. Nothing. She's not gonna congratulate you, she's just gonna sit there being correct. 🀫

The options are:

  • -l β€” print the byte number (decimal) and the differing bytes (hexadecimal) for each difference. Every single mismatch gets receipts, in hex, no cap. πŸ“
  • -s β€” print nothing for differing files, but set the exit status. Quiet girl mode: she won't say a word, she'll just tell you through the exit status. 🀐
  • -L β€” print the line number of the first differing byte. One number, one line, straight to the point. πŸ“

If offsets are given, comparison starts at the designated byte position of the corresponding file. And here's how you tell her which base you're speaking, pay attention this part matters:

  • offsets that begin with 0x β†’ hexadecimal
  • offsets that begin with 0 β†’ octal
  • offsets that begin with anything else β†’ decimal

πŸ“‚ SOURCE πŸ“‚

/src/cmd/cmp.c


πŸ‘€ SEE ALSO πŸ‘€

diff(1) β€” her sibling, also iconic, different energy. 🌈


🚨 DIAGNOSTICS 🚨

  • If a file is inaccessible or missing, the exit status is
  • If the files are the same, the exit status is empty (true).
  • If they are the same except that one is longer than the other, the exit status is
  • Otherwise cmp reports the position of the first disagreeing byte and the exit status is
ngl bestie, the exit status numbers are straight up missing from this copy of the page β€” it says "the exit status is" and then just… stops. 😭 Not me inventing numbers to fill the gap, that is NOT the vibe. If you need the actual values, go read the source at /src/cmd/cmp.c, she'll tell you herself. 🫢

And that's the page, fr fr. This one's CMP(1plan9) β€” yep, that's the Plan 9 manual, section 1, and the footer doesn't give us a date so I'm gonna call it timeless ✨. Same name top and bottom, CMP(1plan9), because consistency is main character energy. Bye babes, go compare something. πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from