John McKown wrote:
I just had to post this. Sorry if it is stupid. I just write a little
shell function which was inspired by a Tech Tip on page 56 of the Dec 2008
Linux Journal magazine. I call it "smart_cat" because it does the
equivalent of a "cat" command, but invokes the appropriate command based
on the last qualifier of the input file name to, hopefully, properly
process the file (e.g. uncompress it). I source this in my .bashrc
file.

function smart_cat()
{
        local i
        for i in "$@";do
                case "$i" in
                        *.gz) zcat "$i"
                        *.bz2) bzcat "$i"
                        *.lzma) lzcat "$i"
                        *.Z) zcat "$i"
                        *) cat "$i"
                esca
        done
}


Learning is good. It's not learning that's stupid.


.... when will they ever learn.


--

Cheers
John

-- spambait
[EMAIL PROTECTED]  [EMAIL PROTECTED]
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to