Sign in
apache
/
joshua
/
refs/tags/v6.0.3
/
.
/
scripts
/
training
/
scat
blob: 473adb48cbe00d6e1749bad61f1ef5bde012bda2 [
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 $file
)
if
[[
$text
=~
"gzip"
]];
then
gzip
-
cd $file
elif
[[
$text
=~
"bzip2"
]];
then
bzcat $file
else
cat $file
fi
done