#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

in=$1
out=$2

if ( command -v sha1sum > /dev/null ); then
  (sha1sum $in | cut -d' ' -f1) > $out
elif ( command -v shasum > /dev/null ); then
  (shasum -a 1 $in | cut -d' ' -f1) > $out
else
  echo "Neither sha1sum nor shasum command is available"
  exit 1
fi
