O'Reilly logo
  • QIAN Weishuo thinks this is interesting:

if sort -c fileToCheck ; then echo sorted ; else echo unsorted ; fi

From

Cover of Linux Shell Scripting Cookbook - Third Edition

Note

如果遇到第一处逆序行,还是会打出来;当然,结果不影响