Skip to content

Instantly share code, notes, and snippets.

@meandavejustice
Created April 10, 2014 20:28
Show Gist options
  • Save meandavejustice/10420047 to your computer and use it in GitHub Desktop.
Save meandavejustice/10420047 to your computer and use it in GitHub Desktop.
#!/bin/bash
# http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/
if [ ! -t 0 ]; then
file=/dev/stdin
elif [ -f $1 ]; then
file=$1
else
echo "Usage: $0 code.js"
echo "or e.g. head code.js|$0"
exit 1
fi
pygmentize -f terminal -g $file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment