shsort ====== a recursive quicksort in pure posix shell script using any arbitrary function or command capable of parsing a comparison expression and outputing "yes" or "no." (e.g., anything that takes a string in the form of "1 > 3" as a command line argument and echoes "no" and takes "1 < 3" and echoes "yes".) 34 SLOC. usage: shsort [-r] [] shsort expects a newline delimited list of elements to sort. the list may be passed via stdin in or on the command line as the argument. the comparator command is used as-is and may be a string including flags. for example: $ printf "2.9\n1.2\n3.4\n2.1\n2.1-rc0\n2.12" | shsort "vercmp -f default" 3.4 2.12 2.9 2.1 2.1-rc0 1.2 `-r` reverses the sort order: $ printf "2.9\n1.2\n3.4\n2.1\n2.1-rc0\n2.12" | shsort -r "vercmp -f default" 1.2 2.1-rc0 2.1 2.9 2.12 3.4