delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/25/05:50:59

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
To: cygwin AT cygwin DOT com
From: Axel Dreher <axeldreher AT gmx DOT de>
Subject: Issues with read and loop in bash
Date: Mon, 25 Oct 2004 09:47:39 +0000 (UTC)
Lines: 65
Message-ID: <loom.20041025T112809-629@post.gmane.org>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: main.gmane.org
User-Agent: Loom/3.14 (http://gmane.org/)
X-Loom-IP: 217.110.222.146 (Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.8a3) Gecko/20040817)
X-IsSubscribed: yes

Hello @all, 

I`m new to this group, so please apologize if my posting does not conform to
formal restrictions. ;-)

In addition, my english is quite poor, so please apologize this too. ;-)

Well, I have following problem. I searched this already in the gmane-database
for this newsgroup, but didn`t find an appropriate answer. (possible bad
searchwords?)

I wrote a shell script using bash at Suse 9.1.
This shell script includes following section:
----------------snip-------------------------------
while read lines 

   do 
       check=FALSE
       while read lines_2 
         
           do
	        if ([ $lines = $lines_2 ]) then    # this is line 63
		
		check=TRUE
		break
		
		fi
		
           done < $3/only_hashes_right.log
   
     if ([ $check = FALSE ]) then
     
        echo $lines >> $3/singles_only_hashes.log
     
     fi
   
   done < $3/only_hashes_left.log
-----------------------snip------------------------------------

The logfiles just have hashes (of pdf-files) inside, created by md5sum.
Each of the 2 logfiles have some thousand of these hashes, one per line.
In the outer loop each hash is read from the first logfile and will be compared 
with each hash in the second logfile using the inner loop. If a "Partner" is
found, the inner loop breaks. If no Partner is found, this hash is printed in a
third logfile called singles_only_hashes.log, as you can see above.
I`m not sure if the check-variable is necessary, though.
With Suse this section and the whole script works properly, but not with bash
under cygwin with Windows XP. It creates following error message:

line 63: [: too many arguments

and this a thousand of times. I marked the corresponding line in the script
above. I also used as "shebang" this: #!/bin/bash instead of #!/bin/sh, 
but this didn`t solve the problem.

Could anybody point me to the right direction?

Any help is greatly appreciated.

Best regards, 

Axel Dreher





--
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