No, I expect the program to do exactly what the manual says. -h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)
Applying -h to the list in my example is expected to be semantically equivalent to not applying -h: A = { echo -e "a1\na2" | sort } B = { echo -e "a1\na2" | sort -h } ~ $ echo -e "a1\na2" | sort a1 a2 ~ $ echo -e "a1\na2" | sort -h a1 a2 Since A = B, the result of -u must be the same on both sets, by logic. The program, however, has a mind of its own. ~ $ echo -e "a1\na2" | sort -u a1 a2 ~ $ echo -e "a1\na2" | sort -h -u a1 -------- Original Message -------- On 2/16/25 23:22, Paul Eggert <egg...@cs.ucla.edu> wrote: > On 2025-02-16 03:02, Rupert Gallagher wrote: > > The introduction of the unique operator (-u) returns a wrong answer when > used with the human sorting operator (-h). > > The answer is "wrong" only in the sense that sort's documented and > implemented behavior is not what you expect. > > To fix this mismatch between behavior and expectations, don't use -h. It > makes sense to not use -h, -h is not intended for uses like that. >