Skip to content

Instantly share code, notes, and snippets.

@mcenirm
Last active October 30, 2017 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcenirm/eb530bb1ac9e792eaa08780a1beff476 to your computer and use it in GitHub Desktop.
Save mcenirm/eb530bb1ac9e792eaa08780a1beff476 to your computer and use it in GitHub Desktop.
$ names=(missing older newer);echo '```';for op in -ot -nt;do echo;echo "# a $op b";echo;for a in "${names[@]}";do echo -n \|;for b in "${names[@]}";do echo -n " \`$a $op $b\` = ";test "$a" "$op" "$b";echo -n "$? |";done;echo;done;done

a -ot b

| missing -ot missing = 1 | missing -ot older = 0 | missing -ot newer = 0 | | older -ot missing = 1 | older -ot older = 1 | older -ot newer = 0 | | newer -ot missing = 1 | newer -ot older = 1 | newer -ot newer = 1 |

a -nt b

| missing -nt missing = 1 | missing -nt older = 1 | missing -nt newer = 1 | | older -nt missing = 0 | older -nt older = 1 | older -nt newer = 1 | | newer -nt missing = 0 | newer -nt older = 0 | newer -nt newer = 1 |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment