From: Meino Christian Cramer <Meino.Cramer@gmx.de>
To: pws@csr.com
Cc: zsh-users@sunsite.dk
Subject: Re: RFT: Request for a trick :O)
Date: Mon, 08 Aug 2005 17:44:28 +0200 (CEST) [thread overview]
Message-ID: <20050808.174428.74748814.Meino.Cramer@gmx.de> (raw)
In-Reply-To: <23359.1123497689@csr.com>
From: Peter Stephenson <pws@csr.com>
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.
>
> **********************************************************************
>
next prev parent reply other threads:[~2005-08-08 15:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-06 4:56 Meino Christian Cramer
2005-08-06 7:50 ` Michal Politowski
2005-08-06 8:35 ` Meino Christian Cramer
2005-08-08 10:04 ` Peter Stephenson
2005-08-08 10:35 ` Stephane Chazelas
2005-08-08 10:41 ` Peter Stephenson
2005-08-08 15:44 ` Meino Christian Cramer [this message]
2005-08-08 16:02 ` Peter Stephenson
2005-08-08 16:34 ` Meino Christian Cramer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050808.174428.74748814.Meino.Cramer@gmx.de \
--to=meino.cramer@gmx.de \
--cc=pws@csr.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).