Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: RFT: Request for a trick :O)
- X-seq: zsh-users 9269
- From: Meino Christian Cramer <Meino.Cramer@xxxxxx>
- To: pws@xxxxxxx
- Subject: Re: RFT: Request for a trick :O)
- Date: Mon, 08 Aug 2005 17:44:28 +0200 (CEST)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <23359.1123497689@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200508081004.j78A4Es4006122@xxxxxxxxxxxxxx> <20050808103515.GB28454@xxxxxxxxxxxxx> <23359.1123497689@xxxxxxx>
From: Peter Stephenson <pws@xxxxxxx>
Subject: Re: RFT: Request for a trick :O)
Date: Mon, 08 Aug 2005 11:41:29 +0100
Hi,
thanks for all the help ! :)
I did not need the exact position and byte counts of differing bytes
at all. I only need a "yes" or "no" whether I have identical file
(and can delete the doublettes).
I saw this "broken pipe"-thingy and didnt dare to delete files on the
base of this...I thought I did something very wrong (I amstill a very
new zsher ;).
"Broken pipe" means: different files.
Ok...if my memory serves me right...the return status of the last
command in a pipe is the return status of the whole pipe, isn't it ?
But unfortunately, the cmp is the first command in that construction...
I think with something like
function zipcmp ()
{
cmp <(7z x -so $1 2>/dev/null ) <(7z x -so $2 2>/dev/null )
}
if [ ! zipcmp $1 $2 ]
then
rm -f $1
fi
I mostly would get an empty harddisc.... ;)
How can I get the return code of cmp, if <( is implemented as a pipe
?
Keep zshing!
Meino
> Stephane Chazelas wrote:
> > > > Extracting GlassBowl001.blend/usr/bin/7z: line 2: 5488 Broken pipe
> > > > /usr/lib/p7zip/7z "$@"
> > > > Extracting GlassBowl001.blend/usr/bin/7z: line 2: 5492 Broken pipe
> > > > /usr/lib/p7zip/7z "$@"
> > >
> >
> > I think it's rather because cmp stops reading at the first
> > difference -> so exit -> so close the pipes -> so the feeders
> > get a SIGPIPE.
> >
> > That's normal and expected, you'd get the same with:
> >
> > 7z ... | cmp - other-file
>
> You're right. I'd assumed the files were actually identical, but reading
> back I see Meino did say they weren't. The "broken pipe" is simply a
> detail of the implementation of the <( ... ).
>
> Meino, if you want a full comparison to the end of the file, you can
> use "cmp -l", which will give lots of output. Otherwise, you can redirect
> 2>/dev/null in the p7zip command.
>
> pws
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> **********************************************************************
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author