Skip to content

Instantly share code, notes, and snippets.

@gnrfan
Created March 28, 2010 20:11
Show Gist options
  • Save gnrfan/347001 to your computer and use it in GitHub Desktop.
Save gnrfan/347001 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# A markdown previewer by Antonio Ognio <[email protected]>
#
# Should work in a UNIX-like system using Bash such as GNU/Linux or Mac OS X#
# It depends on the uuid and markdown commands.
# In Ubuntu just type this: apt-get install uuid markdown
#
UUID=$(uuid)
BASENAME=$(basename $1)
FILENAME="/tmp/$BASENAME-$UUID.html"
echo -n "Creating temporary file at $FILENAME..."
markdown $1 > $FILENAME 2> /dev/null
echo " [done]"
#google-chrome $FILENAME #Uncomment for google-chrome
firefox $FILENAME
sleep 5
echo -n "Deleting temporary file at $FILENAME..."
rm $FILENAME 2>&1 >> /dev/null
echo " [done]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment