#!/usr/bin/env bash set -eu set -o pipefail # replace the extension for a filename FILEPATH="${1:?Have to provide a filepath to replace the extension for}" REPLACE_EXTENSION="${2:?Must provide extension to replace extension with}" printf '%s.%s\n' "$(remove-extension "${FILEPATH}")" "${REPLACE_EXTENSION#.}"