From c0e875a4ebf85dd572637c6ad8a3498c4f7e728b Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Sat, 17 Feb 2024 12:49:21 +0100 Subject: [PATCH] add pst script for internal pastebin --- bin/pst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 bin/pst diff --git a/bin/pst b/bin/pst new file mode 100755 index 0000000..3239f28 --- /dev/null +++ b/bin/pst @@ -0,0 +1,15 @@ +#!/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"