15 lines
320 B
Bash
Executable file
15 lines
320 B
Bash
Executable file
#!/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"
|