delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/08/05/10:22:18

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>,
<http://sourceware.cygnus.com/ml/#faqs>
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <37A99DAA.975036DA@mitre.org>
Date: Thu, 05 Aug 1999 10:20:28 -0400
From: Tim Taylor <ttaylor AT mitre DOT org>
Organization: The MITRE Corporation
X-Mailer: Mozilla 4.61 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Why doesn't this work?

Can anyone tell me why this script always outputs "fail"?

=========== beginning of script ============
#! /bin/sh
if echo line2 from branch1 | cmp - file1 >/dev/null; then
  echo pass
else
  echo fail
fi
============= end of script ==============

The file1 in the above script contains the following (without the
quotes):

"line2 from branch1\r\n"

where \r\n is actually 0x0D0A

The output from my uname command is shown below
bash-2.02$ uname -a
CYGWIN_NT-4.0 TAYLOR-NT 21.0 (0.8/1/2) 1999-1-18 00:09:41 i686 unknown

When I try running cmp from the command line using:
bash-2.02$ cmp - file1<ENTER>
line2 from branch1<CTL-D>

I get the following error message:
cmp: EOF on -
appearing on the same line as the text I typed.  Then I get the bash
prompt.  As soon as I type a key, bash outputs the text I typed (line2
from branch1) followed by the new key.

Any help would be greatly appreciated.
- Tim Taylor

--
======================================================================
 Timothy L. Taylor                        Internet: ttaylor AT mitre DOT org
 Lead Software Systems Engineer              Voice: (781) 271-8770
 The Mitre Corporation                         Fax: (781) 271-7231
 202 Burlington Rd.                      Mail Stop: B295
 Bedford, Massachusetts 01730-1420
======================================================================




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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