Title: [Bash] puush-ss.sh Author: flabrus Pastebin link: http://pastebin.com/EGcafGRX First Edit: Friday 24th of July 2015 08:04:49 PM CDT Last Edit: Friday 24th of July 2015 08:04:49 PM CDT #!/bin/sh ## This script uses scrot to take a screenshot and curls it to puush's API   # The message that the user will be sent. MESSAGE=""   # API key definition. API_KEY_FILE="/home/$USER/.puush.api"   # Read in the user's API key if [ -f $API_KEY_FILE ] then     source $API_KEY_FILE       # Make sure the key is defined     if [ -z "$PUUSH_API_KEY" ]         then             MESSAGE="Please set the variable PUUSH_API_KEY in $API_KEY_FILE."         notify-send "Puush failed." "$MESSAGE"             exit 1         fi   else     MESSAGE="No API key file found at $API_KEY_FILE ...exiting."     notify-send "Puush failed." "$MESSAGE"     exit 1 fi   # Timestamp for filename STAMP=`date +%s`   # Temp file for screenshot TMPFILE="/tmp/shot.png"   # If we're saving a local copy, do it here. SAVE_DIR="/home/$USER/Pictures/puush/"   # Take the actual screenshot. # This is where the user gets the cross and can select a portion of the screen scrot -s $TMPFILE   # If the SAVE_DIR is defined, save the file. if [ -d $SAVE_DIR ] then     cp $TMPFILE $SAVE_DIR/$STAMP.png     MESSAGE="$MESSAGE\n\nFile saved to $SAVE_DIR" else     MESSAGE="$MESSAGE\n\nFile not saved since $SAVE_DIR doesn't exist." fi   # Make the curl request to puush's API, # pass along the API key, # post the screenshot file, # strip garbage from the result of the curl request, # and put it on the user's clipboard curl -s "https://puush.me/api/up" -# -F "k=$PUUSH_API_KEY" -F "z=poop" -F "f=@$TMPFILE" | sed -E 's/^.+,(.+),.+,.+$/\1\n/' | xclip -selection c   MESSAGE="Success. URL copied to clipboard."   # Finally send the message notify-send "Puushed!" "$MESSAGE"   # Exit nicely. exit 0