delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/10/24/13:33:35

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
References: <471F6D98 DOT 3030301 AT gmail DOT com>
Subject: RE: weird behaviour of shell commands
Date: Wed, 24 Oct 2007 18:33:14 +0100
Message-ID: <029401c81663$f49862e0$2e08a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <471F6D98.3030301@gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 24 October 2007 17:07, Cyril Rutkowski wrote:

> Hi,
> 
> When executing chev.sh (a bad performance script that allows me to
> reverse lines of a text file), the result (chev2.txt) should have a size
> of 1565 bytes, that is the same size as chev.txt.

  But chev.txt is 2046 bytes!

> The problem is it won't. Weirder, the result gives random sizes
> everytime (sometimes 1563, 1559 etc.).
> I don't understand what happens at all.

  Well, run it several times, keep /all/ the chev2.txt files, and compare them
using "diff" to see what's going wrong.

> Files : versions*.jpg : versions of all installed cygwin packages

  Dude.  That's so....  um... imaginative.  But not the easiest way to do it.

  Next time, please run "cygcheck -s -v -r > cygheck.out" and then send the
file as an attachment.

>           chev.sh : the shell script that gives the wrong result
>           chev.txt : the file text needed for chev.sh to work

  I ran chev.sh half-a-dozen times and always got the same (right) answer.
Perhaps there's some software like a dodgy antivirus on your machine that's
breaking the shell pipelines in cygwin; you might want to see if any of the
software listed on BLODA is on your computer:

http://cygwin.com/ml/cygwin-talk/2007-q4/msg00026.html


  In the meantime, the easiest way to solve your problem is to throw away your
script (believe me, with quadratic behaviour like that it's going to become
unbearable with larger files) and use 'tac' instead, which is just like 'cat'
but outputs lines backwards - exactly what you want!



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019