On 6/24/21 11:49 PM, Erik Auerswald wrote:
     $ shuf -i 2-0 ; echo %exit code $?
     shuf: invalid input range: ‘2-0’
     %exit code 1
     $ shuf -i 1-0 ; echo %exit code $?
     %exit code 0

This looks inconsistent and possibly not exactly as intended.

It's exactly what I intended and there's no inconsistency. When you say 'shuf -i M-N' you select from a collection of N-M+1 lines. N-M+1 = 0 (no input lines) makes sense, but N-M+1 < 0 (negative number of input lines?) does not.

I'd like to
 document it and add test cases.

Feel free, though we need to reserve the right to extend 'shuf' in the future. In other words, not every invocation of 'shuf' that provokes a diagnostic now will provoke a diagnostic in the future.



Reply via email to