Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
TextExpander snippet for saving clipboard image to disk and writing markdown link for it.
#!/usr/bin/env bash
uuid_str=$(/usr/local/bin/uuid)
dir="/Users/my-account/my-wiki/images/"
target="$dir$uuid_str.png"
var=$(/usr/local/bin/pngpaste $target 2>&1)
if [ "$var" == "No PNG data found on the clipboard!" ];
then
echo "No-PNG"
else
echo "[![$uuid_str.png](images/$uuid_str.png)](images/$uuid_str.png)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment