#!/bin/sh # @(#$Id: rcluncomp,v 1.3 2007-10-27 08:40:25 dockes Exp $ (C) 2004 J.F.Dockes # Uncompress file using any program like gunzip/bunzip2. We jump through # hoops to let the decompressor remove the compression suffix in the file # name. The input directory must be empty on entry. if test $# != 3 -o ! -f "$2" -o ! -d "$3" ; then echo "Usage: rcluncomp " exit 1 fi uncomp=$1 infile=$2 outdir=$3 sinfile=`basename "$infile"` #echo "rcluncomp: $sinfile" 1>&2 # What we do depends on suffix existence. case "$sinfile" in *.*) cp "$infile" "$outdir/$sinfile" || exit 1 $uncomp "$outdir/$sinfile" || exit 1 uncompressed=`echo $outdir/*` ;; *) $uncomp < "$infile" > "$outdir/$sinfile" || exit 1 uncompressed="$outdir/$sinfile" ;; esac cat <