zcat bug on mac osx
There's a bug on Mac OS X's (Lion) default zcat utility that appends a ".Z" suffix to your .gz files automatically.
I discovered it when running a shell script to copy/download a remote postgresql database dump zipped up in .gz format and when I tried to unarchive it.
- calvin$ ./fetch_server_db.sh
- remote db dump (gzip)
- copying remote dump to localhost
- pg_dump_2011-10-17_16-06-36.db.gz 100% 881KB 220.2KB/s 00:04
- deleting remote file
- loading dump in local db
- ALTER SCHEMA
- zcat: pg_dump_2011-10-17_16-06-36.db.gz.Z: No such file or directory
THE FIX
Fortunately for us, there's another utility on Mac OS X called gzcat which works perfectly fine. And since most of my colleagues use the same zcat command in my shell script, I decided to replace my broken zcat utility like that:-- calvin$ sudo mv /usr/bin/zcat /usr/bin/broken-zcat
-
- calvin$ sudo ln -s /usr/bin/gzcat /usr/bin/zcat
- calvin$ broken-zcat --version
- broken-zcat 1.3.12
- Copyright (C) 2007 Free Software Foundation, Inc.
- Copyright (C) 1993 Jean-loup Gailly.
- This is free software. You may redistribute copies of it under the terms of
- the GNU General Public License <http: www.gnu.org="" licenses="" gpl.html="">.
- There is NO WARRANTY, to the extent permitted by law.
-
- Written by Jean-loup Gailly.</http:>
Category: OS X



Leave a Comment :
Leave a Comment