3 ms·
function cmp($l, $r) {"$(gc $l)" -eq "$(gc $r)"} Though, in real life you should compare the lengths of the files before reading them.
by 13of40 11y ago
function cmp($l, $r) {"$(gc $l)" -eq "$(gc $r)"}
Though, in real life you should compare the lengths of the files before reading them.
- vram22 11y agoI do that in my program - compare lengths first. There's also an interesting comment there by a reader about how filecmp (which can do the job) uses stat info with a cache. What language is that? shell? and what is gc?
- 13of40 11y agoPowerShell. GC is Get-Content. (It's actually horribly inefficient because it tags every line read from the file with half a dozen metadata properties, but it looks good in one-liners.)