blob: ac11c95af175edb6288b76d3715ce5dd8d87dee6 [file] [log] [blame]
#!/bin/bash
# Smart cat: calls cat, zcat, or bzcat on each of a list of files, as
# appropriate.
for file in $@; do
text=$(file -L $file)
if [[ $text =~ "gzip" ]]; then
gzip -cd $file
elif [[ $text =~ "bzip2" ]]; then
bzcat $file
else
cat $file
fi
done