Subject: Re: tar verify
To: Sanesh Bodasing <saneshb@cat.co.za>
From: David Maxwell <david@vex.net>
List: netbsd-users
Date: 12/19/2000 11:02:38
On Fri, Dec 15, 2000 at 03:36:31PM -0000, Sanesh Bodasing wrote:
> Hi,
>
> I've just started to learn scripts, and am have a problem with tar.
> It seems that tar returns a value of 0 irrespective of the tar being successfull of unsuccessfull. This makes it difficult to verify that the tar actullly worked.
> Does anyone know how to verify if a tar was successfull?
Is this the failure mode you are referring to - returning '0' on an unsuccessful
read of a tarfile? (Same happens with Extract, vs Tell, btw)
It looks wrong to me, though the manpage doesn't specify the expected
exit codes.
Script started on Tue Dec 19 09:39:28 2000
leaf% pwd
/tmp
leaf% tar czvf /tmp/a.tgz /etc/hosts && echo success
tar: Removing leading / from absolute path names in the archive.
etc/hosts
success
leaf% tar czvf /etc/hosts && echo success
tar: tar: can't open archive /etc/a.tgz : Permission denied
Removing leading / from absolute path names in the archive.
etc/hosts
Broken pipe
leaf% tar czvf /tmp/a.tgz /etc/hosts && echo success
tar: Removing leading / from absolute path names in the archive.
etc/hosts
success
leaf% tar tzvf a.tgz && echo success
-rw-r--r-- root/wheel 722 Nov 23 21:46 2000 etc/hosts
success
leaf% tar tzvf b.tgz && echo success
tar: can't open archive b.tgz : No such file or directory
tar: child returned status 3
success
--
David Maxwell, david@vex.net|david@maxwell.net -->
(About an Amiga rendering landscapes) It's not thinking, it's being artistic!
- Jamie Woods