caused by the standard (and correct) behavior of the shell to discard the return status of lvalue-operands in a pipe-chain. The solution is to not pipe the file-acquisition directly into sort(1) but instead store the output (allowing immediate testing of the return status) and later sort it.