bsdtar vs gnutar

Tim Kientzle kientzle at freebsd.org
Tue Sep 7 22:35:15 PDT 2004


Vladimir Grebenschikov wrote:
> 
> GNU tar has ability to show detailed info on extract in case when more
> then one 'v' letter specified like:
> 
> $ gtar -xvvzf arch.tar.gz
> -rwxrwxr-x ivan/ivan       268 Sep  6 16:40 2004 install
> $ tar -xvvzf arch.tar.gz
> x install

I'll look into this.  Probably won't make it into 5.3, though.

> Another problem, gnu tar output -v output while extracting on stdout,
> but BSD tar output this on stderr ("tar -xvzf arch.tar.gz | head -n1" no
> longer work)

Not always.  ;-)  Sometimes gnutar outputs to stderr,
sometimes to stdout.  POSIX.1-1997 clearly specifies
stderr.  (Yet another place where gtar ignores the POSIX
standards... ;-/

I suggest you try
     tar -xvzf arch.tar.gz |& head -n1
or
     tar -xvzf arch.tar.gz 2>&1 | head -n1

which will work correctly with either gtar or
bsdtar.

Cheers,

Tim Kientzle



More information about the freebsd-current mailing list