aboutsummaryrefslogtreecommitdiff
path: root/ptmp
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2020-12-01 22:00:12 -0500
committerRyan Kavanagh <rak@rak.ac>2020-12-01 22:00:12 -0500
commitf945d4df3ca3d50c77709ec666acc190100df8e7 (patch)
tree6450b26535494cda9ae8168d1c3f28381be420de /ptmp
parentreadme (diff)
Handle different md5sum implementations
Diffstat (limited to 'ptmp')
-rwxr-xr-xptmp10
1 files changed, 9 insertions, 1 deletions
diff --git a/ptmp b/ptmp
index e2446c5..e42c695 100755
--- a/ptmp
+++ b/ptmp
@@ -30,7 +30,15 @@ shift `expr $OPTIND - 1`
FILE="$@"
-PAD=$(md5sum "${FILE}" | cut -f1 -d' ')
+if command -v md5sum >/dev/null; then
+ MD5=md5sum;
+elif command -v md5 >/dev/null; then
+ MD5="md5 -r";
+else
+ echo "No md5 found";
+fi
+
+PAD=$(${MD5} "${FILE}" | cut -f1 -d' ')
BASE=$(basename "${FILE}")
DEST_NAME="${PAD}.${BASE}${OPT_SUFFIX}"