Skip to content

Instantly share code, notes, and snippets.

@ralavay
Last active December 24, 2015 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralavay/6878441 to your computer and use it in GitHub Desktop.
Save ralavay/6878441 to your computer and use it in GitHub Desktop.
Enable syntax highlight via LESS comand
#!/bin/bash
#
# Enable syntax highlight mode in LESS command by using source-highlight
# http://www.gnu.org/software/src-highlite/
sudo apt-get install source-highlight -y
cat >> ~/.bashrc <<EOF
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=" -R"
EOF
source ~/.bashrc
echo "
########################################
open a .sh file with 'less' command
if not -> run 'source .~/bashrc' again
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment