COME ON, LEARN TOGETHER THROUGH THIS BLOG

Friday, May 20, 2011

SCRIPT TO VIEW THOSE COMPRESSED

SCRIPT TO VIEW THOSE COMPRESSED
From a newbie to another, here is a short script that eases looking for and viewing howto documents. My howto's are in /usr/doc/faq/howto/ and are gzipped. The file names are XXX−HOWTO.gz, XXX being the subject. I created the following script called "howto" in the /usr/local/sbin directory :

#!/bin/sh
if [ "$1" = "" ]; then
ls /usr/doc/faq/howto | less
else
gunzip −c /usr/doc/faq/howto/$1−HOWTO.gz | less
fi



When called without argument, it displays a directory of the available howto's. Then when entered with the first part of the file name (before the hyphen) as an argument, it unzips (keeping the original intact) then displays the document.
For instance, to view the Serial−HOWTO.gz document, enter :

$ howto Serial

No comments:

Post a Comment