#!/usr/bin/env bash id=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 2 | head -n 1 ) if [ $# != 1 ]; then echo "needs an arg" else if [ -f "$1" ]; then ext="${1##*.}" id="$id.$ext" scp -P 22222 "$1" ferrn:~/www/nerd/uploads/"$id" echo "https://u.peppe.rs/$id" if hash xclip 2> /dev/null; then echo "https://u.peppe.rs/$id" | xclip -selection clipboard echo "https://u.peppe.rs/$id" | xclip -i fi else echo "file does not exist" fi fi