Created
January 9, 2012 14:56
-
-
Save matthewlmcclure/1583268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat_maybe_compressed() | |
{ | |
local type='' | |
local cat='' | |
for f in "$@" | |
do | |
type=$(file -b "$f" | cut -d ' ' -f 1) | |
case $type in | |
"ASCII") | |
cat=cat | |
;; | |
"gzip") | |
cat='gzip -dc' | |
;; | |
esac | |
$cat $f | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment