scripts, shell

Less can do more…

… more than you think ;)

less is a command that allows you to view and move forward and backwards in a file among other things. But the interesting thing is that less allows you to define a preprocessor. You can set it as the form of a shell script specified in the LESSOPEN environment variable.

$ echo $LESSOPEN
lessopen.sh %s

This is the script that will be invoked before the actual less command (located in /usr/bin/less) is executed. The result of the script must be something readable. If you take a look at the script you will find what kind of files can be lessed (.cab, .rpm, .tar.gz, etc…)

Enjoy!

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*Required Fields