Skip to content

Instantly share code, notes, and snippets.

@mattdconnell
Created April 17, 2017 16:54
Show Gist options
  • Save mattdconnell/fc39521f17ef046ff4d15cbf2475da58 to your computer and use it in GitHub Desktop.
Save mattdconnell/fc39521f17ef046ff4d15cbf2475da58 to your computer and use it in GitHub Desktop.
Puush arbitrary file
#!/bin/sh
# Uncommend following line if you would like to add api key in this file
#PUUSH_API_KEY="apikeyhere"
if [ -z "$PUUSH_API_KEY" ]
then
echo "Set the variable PUUSH_API_KEY in $0 or with 'export PUUSH_API_KEY=\"apiKeyHere\""
exit 1
elif [ -z "$1" ]
then
echo "Specify a file to be uploaded"
exit 2
elif ! [ -f "$1" -a -r "$1" ]
then
echo "File '$1' is not valid (it is not a file or it is not readable)"
exit 3
fi
curl "https://puush.me/api/up" -# -F "k=$PUUSH_API_KEY" -F "z=poop" -F "f=@$1" | sed -E 's/^.+,(.+),.+,.+$/\1\n/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment