From 3cfa30895365fc982071d9ade82b1753fe7b9758 Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Fri, 8 Apr 2016 22:25:58 +0000 Subject: [PATCH] order matter --- urchin | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/urchin b/urchin index 3728fa6..c3e0fb3 100755 --- a/urchin +++ b/urchin @@ -148,27 +148,7 @@ Go to https://thomaslevine.com/!/urchin/ for documentation on writing tests. EOF } -# -------------------- Temporary directory -------------------- -urchin_tmp=$(mktemp_dir) -> "${urchin_tmp}/log" - -urchin_exit() { - rm -Rf "${urchin_tmp}" - exit "$@" -} - - # -------------------- Portable wrappers -------------------- -epoch_date() { - date +%s -} -epoch_pax() { - # Based on http://stackoverflow.com/a/7262588/407226 - tmp="$(mktemp_file)" - echo "ibase=8;$({ pax -wx cpio "${tmp}"; echo; } | cut -c 48-59)" | bc - rm "${tmp}" -} - mktemp_dir() { # Support HP-UX mktemp that has wrong exit codes and # can't make directories. @@ -187,7 +167,26 @@ mktemp_file() { echo "${tmp}" } +# -------------------- Temporary directory -------------------- +urchin_tmp=$(mktemp_dir) +> "${urchin_tmp}/log" + +urchin_exit() { + rm -Rf "${urchin_tmp}" + exit "$@" +} + # -------------------- Utilities -------------------- +epoch_date() { + date +%s +} +epoch_pax() { + # Based on http://stackoverflow.com/a/7262588/407226 + tmp="$(mktemp_file)" + echo "ibase=8;$({ pax -wx cpio "${tmp}"; echo; } | cut -c 48-59)" | bc + rm "${tmp}" +} + plural () { # Make $1 a plural according to the number $2. # If $3 is supplied, use that instead of "${1}s".