public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Difference between Sun OS and Cygwin?
@ 2002-05-31  7:53 Robert Mark Bram
  2002-05-31  7:54 ` Difference between Sun OS and cygwin? Christopher Faylor
  2002-05-31  8:13 ` Difference between Sun OS and Cygwin? Randall R Schulz
  0 siblings, 2 replies; 10+ messages in thread
From: Robert Mark Bram @ 2002-05-31  7:53 UTC (permalink / raw)
  To: Cygwin

Howdy all!

Can anyone tell me why I am seeing this difference between Sun and Cygwin?


On a Sun machine

bash-2.03$ cat > filter
one.doc
^C
bash-2.03$ cat filter
one.doc
bash-2.03$ grep .doc$ filter
one.doc
bash-2.03$ cat filter | grep .doc$
one.doc
bash-2.03$

Robert Mark Bram@DIJONG /home/Rob/
$ cat > filter
one.doc


On Cygwin

Robert Mark Bram@DIJONG /home/Rob/
$ cat filter
one.doc

Robert Mark Bram@DIJONG /home/Rob/
$ grep .doc$ filter
one.doc

Robert Mark Bram@DIJONG /home/Rob/
$ cat filter | grep .doc$

Robert Mark Bram@DIJONG /home/Rob/
$

Any help would be appreciated!

Rob

:)
:-}
;-> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Difference between Sun OS and cygwin?
  2002-05-31  7:53 Difference between Sun OS and Cygwin? Robert Mark Bram
@ 2002-05-31  7:54 ` Christopher Faylor
  2002-05-31  9:03   ` Robert Mark Bram
  2002-05-31  8:13 ` Difference between Sun OS and Cygwin? Randall R Schulz
  1 sibling, 1 reply; 10+ messages in thread
From: Christopher Faylor @ 2002-05-31  7:54 UTC (permalink / raw)
  To: cygwin

On Fri, May 31, 2002 at 01:23:05PM +1000, Robert Mark Bram wrote:
>Can anyone tell me why I am seeing this difference between Sun and Cygwin?
>
>On a Sun machine
>
>bash-2.03$ cat > filter
>one.doc
>^C
>bash-2.03$ cat filter
>one.doc
>bash-2.03$ grep .doc$ filter
>one.doc
>bash-2.03$ cat filter | grep .doc$
>one.doc
>bash-2.03$
>
>Robert Mark Bram@DIJONG /home/Rob/
>$ cat > filter
>one.doc
>
>
>On Cygwin
>
>Robert Mark Bram@DIJONG /home/Rob/
>$ cat filter
>one.doc
>
>Robert Mark Bram@DIJONG /home/Rob/
>$ grep .doc$ filter
>one.doc
>
>Robert Mark Bram@DIJONG /home/Rob/
>$ cat filter | grep .doc$

one.doc undoubtedly has a CRLF line ending.  od -c would probably demonstrate
this.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Difference between Sun OS and Cygwin?
  2002-05-31  7:53 Difference between Sun OS and Cygwin? Robert Mark Bram
  2002-05-31  7:54 ` Difference between Sun OS and cygwin? Christopher Faylor
@ 2002-05-31  8:13 ` Randall R Schulz
  2002-05-31  9:01   ` Robert Mark Bram
  1 sibling, 1 reply; 10+ messages in thread
From: Randall R Schulz @ 2002-05-31  8:13 UTC (permalink / raw)
  To: Robert Mark Bram, Cygwin

Robert,

I get the same results. Probably it's that Cygwin text vs. binary thing. 
Dumping the file with "od -c" is the most illustrative of why the grep fails.

Show us your CYGWIN environment variable setting, your mount table and 
confirm that the directory displayed in your prompt is the current 
directory in which you're running the commands you specify.

On my system:

% /bin/pwd
/cygdrive/c/SD/tau/src/tau/fol
%
% echo $CYGWIN
binmode ntsec
%
% pwd
/c/SD/tau/src/tau/fol
%
% ls -l /c
lrwxrwxrwx    1 RSchulz  None           94 Nov 21  2001 /c -> /cygdrive/c
%
% mount
D:\cygwin\usr\X11R6\lib\X11\fonts on /usr/X11R6/lib/X11/fonts type system 
(binmode)
D:\cygwin\bin on /usr/bin type system (binmode)
D:\cygwin\lib on /usr/lib type system (binmode)
D:\cygwin on / type system (binmode)
\\.\A: on /dev/fd0 type user (binmode)
c: on /cygdrive/c type user (binmode,noumount)
d: on /cygdrive/d type user (binmode,noumount)
e: on /cygdrive/e type user (binmode,noumount)
g: on /cygdrive/g type user (binmode,noumount)
h: on /cygdrive/h type user (binmode,noumount)

% cat >file
one.doc
^D
%
% od -c file
0000000   o   n   e   .   d   o   c  \r  \n
0000011
%
% grep .doc$ file
%

Randall Schulz
Mountain View, CA USA


At 20:23 2002-05-30, Robert Mark Bram wrote:
>Howdy all!
>
>Can anyone tell me why I am seeing this difference between Sun and Cygwin?
>
>
>On a Sun machine
>
>bash-2.03$ cat > filter
>one.doc
>^C
>bash-2.03$ cat filter
>one.doc
>bash-2.03$ grep .doc$ filter
>one.doc
>bash-2.03$ cat filter | grep .doc$
>one.doc
>bash-2.03$
>
>Robert Mark Bram@DIJONG /home/Rob/
>$ cat > filter
>one.doc
>
>
>On Cygwin
>
>Robert Mark Bram@DIJONG /home/Rob/
>$ cat filter
>one.doc
>
>Robert Mark Bram@DIJONG /home/Rob/
>$ grep .doc$ filter
>one.doc
>
>Robert Mark Bram@DIJONG /home/Rob/
>$ cat filter | grep .doc$
>
>Robert Mark Bram@DIJONG /home/Rob/
>$
>
>Any help would be appreciated!
>
>Rob


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* RE: Difference between Sun OS and Cygwin?
  2002-05-31  8:13 ` Difference between Sun OS and Cygwin? Randall R Schulz
@ 2002-05-31  9:01   ` Robert Mark Bram
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Mark Bram @ 2002-05-31  9:01 UTC (permalink / raw)
  To: Cygwin

Hi Randall!

Well, I got some different results here (not for grep - for the other
things).

Robert Mark Bram@DIJONG /home/Rob
$ /bin/pwd
/home/Rob

Robert Mark Bram@DIJONG /home/Rob
$ echo $CYGWIN


Robert Mark Bram@DIJONG /home/Rob
$ pwd
/home/Rob

Robert Mark Bram@DIJONG /home/Rob
$ ls -l /c
ls: /c: No such file or directory

Robert Mark Bram@DIJONG /home/Rob
$ mount
C:\cygwin\bin on /usr/bin type system (textmode)
C:\cygwin\lib on /usr/lib type system (textmode)
C:\cygwin on / type system (textmode)
\Rob on /home/Rob type user (textmode)
c: on /cygdrive/c type user (textmode,noumount)
f: on /cygdrive/f type user (textmode,noumount)

Robert Mark Bram@DIJONG /home/Rob
$ cat >file
one.doc

Robert Mark Bram@DIJONG /home/Rob
$ od -c file
0000000   o   n   e   .   d   o   c  \r  \n
0000011

Robert Mark Bram@DIJONG /home/Rob
$ grep .doc$ file
one.doc

Robert Mark Bram@DIJONG /home/Rob
$

What does the GYGWIN variable hold?

Rob
:)

> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Randall R Schulz
> Sent: Friday, 31 May 2002 1:42 PM
> To: Robert Mark Bram; Cygwin
> Subject: Re: Difference between Sun OS and Cygwin?
>
>
> Robert,
>
> I get the same results. Probably it's that Cygwin text vs. binary thing.
> Dumping the file with "od -c" is the most illustrative of why the
> grep fails.
>
> Show us your CYGWIN environment variable setting, your mount table and
> confirm that the directory displayed in your prompt is the current
> directory in which you're running the commands you specify.
>
> On my system:
>
> % /bin/pwd
> /cygdrive/c/SD/tau/src/tau/fol
> %
> % echo $CYGWIN
> binmode ntsec
> %
> % pwd
> /c/SD/tau/src/tau/fol
> %
> % ls -l /c
> lrwxrwxrwx    1 RSchulz  None           94 Nov 21  2001 /c -> /cygdrive/c
> %
> % mount
> D:\cygwin\usr\X11R6\lib\X11\fonts on /usr/X11R6/lib/X11/fonts type system
> (binmode)
> D:\cygwin\bin on /usr/bin type system (binmode)
> D:\cygwin\lib on /usr/lib type system (binmode)
> D:\cygwin on / type system (binmode)
> \\.\A: on /dev/fd0 type user (binmode)
> c: on /cygdrive/c type user (binmode,noumount)
> d: on /cygdrive/d type user (binmode,noumount)
> e: on /cygdrive/e type user (binmode,noumount)
> g: on /cygdrive/g type user (binmode,noumount)
> h: on /cygdrive/h type user (binmode,noumount)
>
> % cat >file
> one.doc
> ^D
> %
> % od -c file
> 0000000   o   n   e   .   d   o   c  \r  \n
> 0000011
> %
> % grep .doc$ file
> %
>
> Randall Schulz
> Mountain View, CA USA
>
>
> At 20:23 2002-05-30, Robert Mark Bram wrote:
> >Howdy all!
> >
> >Can anyone tell me why I am seeing this difference between Sun
> and Cygwin?
> >
> >
> >On a Sun machine
> >
> >bash-2.03$ cat > filter
> >one.doc
> >^C
> >bash-2.03$ cat filter
> >one.doc
> >bash-2.03$ grep .doc$ filter
> >one.doc
> >bash-2.03$ cat filter | grep .doc$
> >one.doc
> >bash-2.03$
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$ cat > filter
> >one.doc
> >
> >
> >On Cygwin
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$ cat filter
> >one.doc
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$ grep .doc$ filter
> >one.doc
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$ cat filter | grep .doc$
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$
> >
> >Any help would be appreciated!
> >
> >Rob
>
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* RE: Difference between Sun OS and cygwin?
  2002-05-31  7:54 ` Difference between Sun OS and cygwin? Christopher Faylor
@ 2002-05-31  9:03   ` Robert Mark Bram
  2002-05-31  9:06     ` Christopher Faylor
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Mark Bram @ 2002-05-31  9:03 UTC (permalink / raw)
  To: cygwin

Howdy Christopher!

Well, I get this when I do od:

Robert Mark Bram@DIJONG /home/Rob
$ cat >file
one.doc

Robert Mark Bram@DIJONG /home/Rob
$ od -c file
0000000   o   n   e   .   d   o   c  \r  \n
0000011

Robert Mark Bram@DIJONG /home/Rob
$ grep .doc$ file
one.doc

Robert Mark Bram@DIJONG /home/Rob
$



So my question then is: why doesn't \r\n count as end of the line for $ in
grep?

And then.. is there a way I can fix it so it works the same in Cygwin as it
would for Sun?

Rob

:)

> -----Original Message-----
> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Christopher Faylor
> Sent: Friday, 31 May 2002 1:32 PM
> To: cygwin@cygwin.com
> Subject: Re: Difference between Sun OS and cygwin?
>
>
> On Fri, May 31, 2002 at 01:23:05PM +1000, Robert Mark Bram wrote:
> >Can anyone tell me why I am seeing this difference between Sun
> and Cygwin?
> >
> >On a Sun machine
> >
> >bash-2.03$ cat > filter
> >one.doc
> >^C
> >bash-2.03$ cat filter
> >one.doc
> >bash-2.03$ grep .doc$ filter
> >one.doc
> >bash-2.03$ cat filter | grep .doc$
> >one.doc
> >bash-2.03$
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$ cat > filter
> >one.doc
> >
> >
> >On Cygwin
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$ cat filter
> >one.doc
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$ grep .doc$ filter
> >one.doc
> >
> >Robert Mark Bram@DIJONG /home/Rob/
> >$ cat filter | grep .doc$
>
> one.doc undoubtedly has a CRLF line ending.  od -c would probably
> demonstrate
> this.
>
> cgf
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Difference between Sun OS and cygwin?
  2002-05-31  9:03   ` Robert Mark Bram
@ 2002-05-31  9:06     ` Christopher Faylor
  2002-05-31  9:07       ` Christopher Faylor
  0 siblings, 1 reply; 10+ messages in thread
From: Christopher Faylor @ 2002-05-31  9:06 UTC (permalink / raw)
  To: cygwin

On Fri, May 31, 2002 at 01:51:44PM +1000, Robert Mark Bram wrote:
>Howdy Christopher!
>
>Well, I get this when I do od:
>
>Robert Mark Bram@DIJONG /home/Rob
>$ cat >file
>one.doc
>
>Robert Mark Bram@DIJONG /home/Rob
>$ od -c file
>0000000   o   n   e   .   d   o   c  \r  \n
>0000011
>
>Robert Mark Bram@DIJONG /home/Rob
>$ grep .doc$ file
>one.doc
>
>Robert Mark Bram@DIJONG /home/Rob
>$
>
>
>
>So my question then is: why doesn't \r\n count as end of the line for $ in
>grep?
>
>And then.. is there a way I can fix it so it works the same in Cygwin as it
>would for Sun?

I spent the last hour trying to track down this "cygwin bug".  It sure didn't
seem to be working the way that I expected.

What I found is that this is a cat "feature":

  /* If stdin is a terminal device, and it is the ONLY
     input file (i.e. we didn't write anything to the
     output yet), switch the output back to TEXT mode.
     This is so "cat > xyzzy" creates a DOS-style text
     file, like people expect.  */
  if (tty_in && optind <= argc)
    setmode (output_desc, O_TEXT);

This is from the cat sources.  I'm a person but I wouldn't expect that
particular behavior.

A workaround may be to do:

cat /dev/tty > filter

That tricks cat into thinking it has an argument so it won't do
any help binmode/textmode conversions.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Re: Difference between Sun OS and cygwin?
  2002-05-31  9:06     ` Christopher Faylor
@ 2002-05-31  9:07       ` Christopher Faylor
  2002-05-31  9:22         ` Arrays in Cygwin? Robert Mark Bram
  0 siblings, 1 reply; 10+ messages in thread
From: Christopher Faylor @ 2002-05-31  9:07 UTC (permalink / raw)
  To: cygwin

On Fri, May 31, 2002 at 12:41:20AM -0400, Christopher Faylor wrote:
>A workaround may be to do:
>
>cat /dev/tty > filter
>
>That tricks cat into thinking it has an argument so it won't do
>any help binmode/textmode conversions.
         ^
         ful

I guess this illustrates why it took me an hour to figure this out.
Yawn.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Arrays in Cygwin?
  2002-05-31  9:07       ` Christopher Faylor
@ 2002-05-31  9:22         ` Robert Mark Bram
  2002-05-31  9:32           ` David Starks-Browning
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Mark Bram @ 2002-05-31  9:22 UTC (permalink / raw)
  To: cygwin

Howdy all!

How can I get arrays in Cygin's Bash?

I did a search in Google search and found this reference to "Cygwin array
patch".
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=551009&group_id=
5470

Is this what I need?

The excerpt below shows the error I get from trying to run a script with an
array in it.

Rob
:)

Robert Mark Bram@DIJONG /home/Rob/
$ cat ass1.sh

# array variables declaration
# different file types
type=( "Image File" "Text File" "Sound Clips")

# store the application for files
program=( "xv" "vi" "showaudio")

# store the extension of the file types
exten=( "*.gif *.jpg *.bmp" "*.txt *.doc" "*.wav *.mp3 *.mid")

# initalise variable to 0
toQuit=0


Robert Mark Bram@DIJONG /home/Rob/
$ sh ./ass1.sh
./ass1.sh: 4: Syntax error: word unexpected (expecting ")")


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* Arrays in Cygwin?
  2002-05-31  9:22         ` Arrays in Cygwin? Robert Mark Bram
@ 2002-05-31  9:32           ` David Starks-Browning
  2002-05-31 10:14             ` Robert Mark Bram
  0 siblings, 1 reply; 10+ messages in thread
From: David Starks-Browning @ 2002-05-31  9:32 UTC (permalink / raw)
  To: Robert Mark Bram; +Cc: cygwin

On Friday 31 May 02, Robert Mark Bram writes:
> The excerpt below shows the error I get from trying to run a script with an
> array in it.
> 
> ...
> 
> Robert Mark Bram@DIJONG /home/Rob/
> $ sh ./ass1.sh
> ./ass1.sh: 4: Syntax error: word unexpected (expecting ")")

"sh" is not bash.  "sh" does not have arrays.  "bash" does.

David


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

* RE: Arrays in Cygwin?
  2002-05-31  9:32           ` David Starks-Browning
@ 2002-05-31 10:14             ` Robert Mark Bram
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Mark Bram @ 2002-05-31 10:14 UTC (permalink / raw)
  To: David Starks-Browning; +Cc: cygwin

Oh.

Thanks very much David!! I was quite lost!

Rob
:)

> -----Original Message-----
> From: David Starks-Browning [mailto:starksb@ebi.ac.uk]
> Sent: Friday, 31 May 2002 9:09 PM
> To: Robert Mark Bram
> Cc: cygwin@cygwin.com
> Subject: Arrays in Cygwin?
> 
> 
> On Friday 31 May 02, Robert Mark Bram writes:
> > The excerpt below shows the error I get from trying to run a 
> script with an
> > array in it.
> > 
> > ...
> > 
> > Robert Mark Bram@DIJONG /home/Rob/
> > $ sh ./ass1.sh
> > ./ass1.sh: 4: Syntax error: word unexpected (expecting ")")
> 
> "sh" is not bash.  "sh" does not have arrays.  "bash" does.
> 
> David
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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

end of thread, other threads:[~2002-05-31 11:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-31  7:53 Difference between Sun OS and Cygwin? Robert Mark Bram
2002-05-31  7:54 ` Difference between Sun OS and cygwin? Christopher Faylor
2002-05-31  9:03   ` Robert Mark Bram
2002-05-31  9:06     ` Christopher Faylor
2002-05-31  9:07       ` Christopher Faylor
2002-05-31  9:22         ` Arrays in Cygwin? Robert Mark Bram
2002-05-31  9:32           ` David Starks-Browning
2002-05-31 10:14             ` Robert Mark Bram
2002-05-31  8:13 ` Difference between Sun OS and Cygwin? Randall R Schulz
2002-05-31  9:01   ` Robert Mark Bram

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