#!/bin/bash set -o errexit set -o nounset set -o pipefail in=$1 out=$2 if ( which sha1sum > /dev/null ); then (sha1sum $in | cut -d' ' -f1) > $out elif ( which shasum > /dev/null ); then (shasum -a 1 $in | cut -d' ' -f1) > $out else echo "Neither sha1sum nor shasum command is available" exit 1 fi