#!/bin/bash set -eo pipefail URL="https://paste.aarn.shelman.io" FILEPATH="$1" FILENAME=$(basename -- "$FILEPATH") EXTENSION="${FILENAME##*.}" RESPONSE=$(curl -s --data-binary "@${FILEPATH:-/dev/stdin}" --url $URL) PASTELINK="$URL$RESPONSE" [ -z "$EXTENSION" ] && echo "$PASTELINK" || echo "$PASTELINK.$EXTENSION"