bin/icyup.sh (view raw)
1#!/usr/bin/env bash
2
3n=3; fn=$(tr -cd '[:alnum:]' < /dev/urandom | head -c$n)
4
5latest="$HOME/pics/scrots/latest.png"
6
7upload() {
8 file=$1
9 ext="${file##*.}"
10 fullname="$fn.$ext"
11 scp -P 443 "$1" emerald:icywww/uploads/"$fullname"
12 echo "https://x.icyphox.sh/$fullname"
13 echo "https://x.icyphox.sh/$fullname" | xclip -selection clipboard
14}
15
16if [ "$1" == "l" ]; then
17 upload "$latest"
18elif [ "$1" != "l" ]; then
19 upload "$1"
20else
21 echo "no path specified :v"
22fi