Does sort -n handle ties predictably when the --stable option is NOT provided? If it does, how?
问题 Here it looks like the space after the 3 in both rows breaks the numerical sorting and lets the alphabetic sorting kick in, so that 11 < 2 : $ echo -e '3 2\n3 11' | sort -n 3 11 3 2 In man sort , I read -s, --stable stabilize sort by disabling last-resort comparison which implies that without -s a last-resort comparison is done (between ties, because -s does not affect non-ties). So the question is: how is this last-resort comparison accomplished? A reference to the source code would be