#!/bin/sh ## Adapted from https://gist.github.com/nl5887/a511f172d3fb3cd0e42d. ## Original author: ## Remco Verhoef curl --version 2>&1 > /dev/null if [ $? -ne 0 ]; then echo "Could not find curl." exit 1 fi if [ $# -eq 0 ]; then cat< $zipfile curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" > $tmpfile rm -f $zipfile else # transfer file curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" > $tmpfile # cat output link out="$out $(cat $tmpfile)" fi done echo "$out" else # transfer pipe curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile # cat output link cat $tmpfile echo fi # cleanup rm -f $tmpfile