Help with GZIP

Hi Gurus,

I have a requirement to zip a file using gzip and ftp it to target server.

I am using a gzip script as below.

gzip.sh
#!/bin/ksh
/usr/bin/gzip -9 $1

Filename for gzip.sh is passed by an application program.

so the output for ./gzip.sh Test_YYYYMMDDHHMMSS.txt (file name is dynamic ) is Test_YYYYMMDDHHMMSS.txt.gz

but requiremnt is that file to be sent is Test_YYYYMMDDHHMMSS.gz not Test_YYYYMMDDHHMMSS.txt.gz

Can you please help me to acomplish this.

Thanks,
Varma

gzip is not a package archiver, it doesn't contain multiple files or archive information of that sort. It can contain information on one file, but has to be told to use it, otherwise it assumes it can just lop the .gz off the end and get the name from that -- Test_YYYYMMDDHHMMSS.gz would become Test_YYYYMMDDHHMMSS instead of Test_YYYYMMDDHHMMSS.txt.

But if you're willing to put up with that:

/usr/bin/gzip -9 -c -N "$1" > "${1%.txt}.gz"

and to restore it:

gunzip -N filename.gz