Skip to content

Instantly share code, notes, and snippets.

@mash
Created July 18, 2013 08:34
Show Gist options
  • Save mash/6027700 to your computer and use it in GitHub Desktop.
Save mash/6027700 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ -t 0 ]; then
# not tty
if [ $# -ne 1 ]; then
echo "usage:"
echo " $0 filename"
echo "or"
echo " cat filename|$0"
exit 1
fi
if [ ! -r $1 ]; then
echo "$1 is not readable"
exit 1
fi
curl -s -H "Content-Type: text/plain" --data-binary @- "https://api.github.com/markdown/raw" < $1
else
curl -s -H "Content-Type: text/plain" --data-binary @- "https://api.github.com/markdown/raw"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment