#!/bin/bash set -euo pipefail POSITIONAL=() while [[ $# -gt 0 ]] do key="$1" case $key in *) # unknown option POSITIONAL+=("$1") # save it in an array for later shift # past argument ;; esac done set -- "${POSITIONAL[@]}" # restore positional parameters FILENAME="${POSITIONAL[0]}" go tool cover -html="$FILENAME" -o "$FILENAME.html" elinks "$FILENAME.html" rm "$FILENAME.html"