Is there a simple use of head and cmp (or otherwise) to achieve this?
You can use the exit status of
Diff compares the files, if the exit status is zero than the files match. Non-zero means they did not match or there was an error running diff which seems unlikely.
Here's a way to do it in Bash without using three calls to external utilities. It also works in POSIX shells that don't have process substitution:
Here's another way using AWK:
Note that AWK comparisons return 1 for true, so I'm using