#!/bin/sh

files="$#"
out=""

while [ "$#" -gt 0 ]; do
	link="$(curl -s -F"file=@$1" http://0x0.st)"
	ident="[$((files - $#))] $link ($1)"

	out="${out}${ident}
"
	echo "$ident"
	shift
done

printf "copy? "
read -r _c

printf "%s" "$out" | grep -w "[$_c]" | cut -d " " -f2 | xclip -sel c
