Stripping Extensions with bash

Kevin P. Fleming kpfleming at
Wed Jan 7 19:12:13 PST 2004

Michael Kipper wrote:

 > There must be some function to do this properly, like `basename` or
 > something like it. Also, if there's a better way to do this, by all
 > means...

You don't need to extract the extension into a separate variable... 
something like this will work:

case $filename in
     tar xzvf $filename
     tar xjvf $filename
     tar xvf $filename
      gunzip $filename
      bunzip2 $filename

(untested so it may contain syntax errors)

More information about the alfs-discuss mailing list