Z="compress"; unZ="uncompress"; Zlist=""
gz="gzip" ; ungz="gunzip" ; gzlist=""
bz="bzip2" ; unbz="bunzip2" ; bzlist=""
for arg ; do
if [ -f "$arg" ]; then
case "$arg" in
*.Z) $unZ "$arg"
arg="$(echo $arg | sed 's/\.Z$//')"
Zlist="$Zlist \"$arg\""
;;
*.gz) $ungz "$arg"
arg="$(echo $arg | sed 's/\.gz$//')"
gzlist="$gzlist \"$arg\""
;;
*.bz2) $unbz "$arg"
arg="$(echo $arg | sed 's/\.bz2$//')"
bzlist="$bzlist \"$arg\""
;;
esac
fi
newargs="${newargs:-""} \"$arg\""
done
case $0 in
*zcat* ) eval cat $newargs ;;
*zmore* ) eval more $newargs ;;
*grep* ) eval grep $newargs ;;
* ) echo "$0: unknow base name. Can't proceed." >&2;
exit 1
esac
if [ ! -z "$Zlist" ]; then
eval $Z $Zlist
fi
if [ ! -z "$gzlist" ]; then
eval $gz $gzlist
fi
if [ ! -z "$bzlist" ]; then
eval $bz $bzlist
fi
exit 0
$ ls ragged.txt
ragged.txt
$ gzip ragged.txt
$ ls ragged.txt.gz
ragged.txt.gz
$ zcat ragged.txt.gz
So she sat on, with closed eyes, and half believed herself in
Wonderland, though she knew she had but to open them again, and
all would change to dull reality--the grass would be only rustling in the wind, and the pool rippling to the waving of the reeds--the
rattling teacups would change to tinkling sheep- bells, and the
Queen's shrill cries to the voice of the shepherd boy--and the
sneeze
of the baby, the shriek of the Gryphon, and all thy other queer noises, would change (she knew)
to the confused clamour of the busy farm-yard--while the lowing of
the cattle in
the distance would take the place of the Mock Turtle's heavy sobs.
$ zgrep teacup ragged.txt.gz
rattling teacups would change to tinkling sheep- bells, and the