aboutsummaryrefslogtreecommitdiffstats
path: root/lesscolor.sh
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2021-05-14 18:14:50 +0000
committerterminaldweller <thabogre@gmail.com>2021-05-14 18:14:50 +0000
commit6e528248414e330c9e25e81596ab47b8b8a5b701 (patch)
treee1aa41a7f3198eeac187e6177ec7d4a33db229d3 /lesscolor.sh
downloadscripts-6e528248414e330c9e25e81596ab47b8b8a5b701.tar.gz
scripts-6e528248414e330c9e25e81596ab47b8b8a5b701.zip
first commitmaster
Diffstat (limited to 'lesscolor.sh')
-rwxr-xr-xlesscolor.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/lesscolor.sh b/lesscolor.sh
new file mode 100755
index 0000000..8ac7efc
--- /dev/null
+++ b/lesscolor.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+case "$1" in
+ *.h|*.c|*.cpp|*.awk|*.groff|*.java|*.js|*.m4|*.php|*.pl|*.pm|*.pod|*.sh|*.lua|*.hpp|*.sh|\
+ *.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|*.json|makefile|Makefile|*.html|\
+ *.lsp|*.l|*.pas|*.p|*.xml|*.xps|*.xsl|*.axp|*.ppd|*.pov|\
+ *.diff|*.patch|*.py|*.rb|*.sql|*.ebuild|*.eclass)
+ pygmentize -f 256 "$1";;
+ .zshrc|.bash_aliases|.bash_environment)
+ pygmentize -f 256 -l sh "$1"
+ ;;
+ *)
+ grep "#\!/bin/zsh" "$1" > /dev/null
+ if [ "$?" -eq "0" ]; then
+ pygmentize -f 256 -l sh "$1"
+ else
+ exit 1
+ fi
+esac
+
+exit 0