public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: Why doesn't this work?
@ 1999-08-09 11:25 Dirk Fieldhouse
  1999-08-31 23:49 ` Dirk Fieldhouse
  0 siblings, 1 reply; 4+ messages in thread
From: Dirk Fieldhouse @ 1999-08-09 11:25 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1944 bytes --]

On Thu, 05 Aug 1999 10:20:28 -0400, Tim Taylor <ttaylor@mitre.org> wrote:

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

FWIW Here's my output:

BASH.EXE-2.01$ pwd
/usr
BASH.EXE-2.01$ echo line2 from branch1>file1
BASH.EXE-2.01$ cat file1
line2 from branch1
BASH.EXE-2.01$ sh
$ echo line2 from branch1§
line2 from branch1§
$ if echo line2 from branch1 | cmp - file1 >/dev/null; then
>   echo pass
> else
>   echo fail
> fi
pass
$ od -x file1
0000000 696c 656e 2032 7266 6d6f 6220 6172 636e
0000020 3168 0a0d
0000024
$ uname -a
CYGWIN_95-4.0 TOSH-SAN 21.0 (0.8/1/1) 1999-1-16 00:09:28 i586 unknown
$

Same result under bash. I suspect a text/binary issue. My /usr is mounted text!=binary.

What happens if you use diff --text [--ignore-blank-lines ¦ --ignore-space-change] instead ?


-- 
Dirk Fieldhouse                 Logica UK Limited
fieldhouse@logica.com           75 Hampstead Road
c=gb;a=attmail;p=logica;        London NW1 2PL
o=LOGICA;ou1=UK;s=fieldhouse    UK
+44 (171) 637 9111

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Why doesn't this work?
  1999-08-09 11:25 Why doesn't this work? Dirk Fieldhouse
@ 1999-08-31 23:49 ` Dirk Fieldhouse
  0 siblings, 0 replies; 4+ messages in thread
From: Dirk Fieldhouse @ 1999-08-31 23:49 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1944 bytes --]

On Thu, 05 Aug 1999 10:20:28 -0400, Tim Taylor <ttaylor@mitre.org> wrote:

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

FWIW Here's my output:

BASH.EXE-2.01$ pwd
/usr
BASH.EXE-2.01$ echo line2 from branch1>file1
BASH.EXE-2.01$ cat file1
line2 from branch1
BASH.EXE-2.01$ sh
$ echo line2 from branch1§
line2 from branch1§
$ if echo line2 from branch1 | cmp - file1 >/dev/null; then
>   echo pass
> else
>   echo fail
> fi
pass
$ od -x file1
0000000 696c 656e 2032 7266 6d6f 6220 6172 636e
0000020 3168 0a0d
0000024
$ uname -a
CYGWIN_95-4.0 TOSH-SAN 21.0 (0.8/1/1) 1999-1-16 00:09:28 i586 unknown
$

Same result under bash. I suspect a text/binary issue. My /usr is mounted text!=binary.

What happens if you use diff --text [--ignore-blank-lines ¦ --ignore-space-change] instead ?


-- 
Dirk Fieldhouse                 Logica UK Limited
fieldhouse@logica.com           75 Hampstead Road
c=gb;a=attmail;p=logica;        London NW1 2PL
o=LOGICA;ou1=UK;s=fieldhouse    UK
+44 (171) 637 9111

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Why doesn't this work?
  1999-08-05  7:19 Tim Taylor
@ 1999-08-31 23:49 ` Tim Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Taylor @ 1999-08-31 23:49 UTC (permalink / raw)
  To: cygwin

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@mitre.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@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Why doesn't this work?
@ 1999-08-05  7:19 Tim Taylor
  1999-08-31 23:49 ` Tim Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Taylor @ 1999-08-05  7:19 UTC (permalink / raw)
  To: cygwin

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@mitre.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@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-08-31 23:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-09 11:25 Why doesn't this work? Dirk Fieldhouse
1999-08-31 23:49 ` Dirk Fieldhouse
  -- strict thread matches above, loose matches on Subject: below --
1999-08-05  7:19 Tim Taylor
1999-08-31 23:49 ` Tim Taylor

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 read-only IMAP folder(s) and NNTP newsgroup(s).