This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: weird behaviour of shell commands


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]