My Scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bin/picbin

58 lines
775 B

#!/bin/bash
# @Auther Stephen Cochrane
set -e
usage () {
echo "<usage> picbin /path/to/picture"
exit $1
}
area=0
while getopts "hp:la" opt
do
case $opt in
h)
usage 0
;;
p)
path="$OPTARG"
;;
l)
link=1
;;
a)
area=1
;;
*)
exit 2
;;
esac
done
if [ $path ]
then
[ 0 -eq $# ] && usage 1
[[ ! -f $path ]] && usage 1
else
if [[ area -eq 0 ]]
then
gnome-screenshot -f /tmp/picbin.png
else
gnome-screenshot -a -f /tmp/picbin.png
fi
path="/tmp/picbin.png"
fi
abort() {
echo "Aborting upload of $path"
exit 0
}
zenity --question --text="Confirm upload."
[ ! $? ] && abort
echo "Uploading -> $path"
url=$(curl -F"file=@$path" https://0x0.st)
echo $url
[ $link ] && zenity --info --window-icon="info" --text="$url" || exit 0