* Re: pdksh: problem with read and string compare
@ 2003-04-24 15:07 Thomas Muehlfriedel
2003-04-24 15:14 ` Igor Pechtchanski
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Muehlfriedel @ 2003-04-24 15:07 UTC (permalink / raw)
To: cygwin
> Ok, so it is an erroneous line endings problem. The tmp file containing
the
> output of the external command has line seps of the form 0x0d 0x0d 0x0a.
> Does it help if I switch the drive to text-mode since drive e is mounted
in
> binmode?
> muehle at sparrow /cygdrive/e/DataDictionary/report/resource
> $ mount
> D:\software\cygwin\bin on /usr/bin type system (binmode)
> D:\software\cygwin\lib on /usr/lib type system (binmode)
> D:\software\cygwin on / type system (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)
> -thomas
I can do whatever I like I cannot get rid of those 0d0d0a at the end of
each line in the tmp file! I mounted the filesystem as text and played with
the CYGWIN env variable. Whenever I redirect multi-line output from a
standard windows program I get those endings. The tmp file looks like this:
00000000: 0d0d 0a31 2020 2020 2020 2020 2020 2020 ...1
00000010: 2020 2020 2020 200d 0d0a 2d2d 2d2d 2d2d ...------
00000020: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 0d0d --------------..
00000030: 0a20 2020 2020 2020 2020 2020 2020 2020 .
00000040: 2020 2020 2d0d 0d0a 0d0d 0a20 2031 2072 -...... 1 r
00000050: 6563 6f72 6428 7329 2073 656c 6563 7465 ecord(s) selecte
00000060: 642e 0d0d 0a0d 0d0a
And all I do is "db2 select ... " >tmp
So why is this so?
-thomas
------------
Who is General Failure and why is he reading my harddisk?
--
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pdksh: problem with read and string compare
2003-04-24 15:07 pdksh: problem with read and string compare Thomas Muehlfriedel
@ 2003-04-24 15:14 ` Igor Pechtchanski
0 siblings, 0 replies; 4+ messages in thread
From: Igor Pechtchanski @ 2003-04-24 15:14 UTC (permalink / raw)
To: Thomas Muehlfriedel; +Cc: cygwin
On Thu, 24 Apr 2003, Thomas Muehlfriedel wrote:
> > Ok, so it is an erroneous line endings problem. The tmp file
> > containing the output of the external command has line seps of the
> > form 0x0d 0x0d 0x0a. Does it help if I switch the drive to text-mode
> > since drive e is mounted in binmode?
>
> > muehle at sparrow /cygdrive/e/DataDictionary/report/resource
> > $ mount
> > D:\software\cygwin\bin on /usr/bin type system (binmode)
> > D:\software\cygwin\lib on /usr/lib type system (binmode)
> > D:\software\cygwin on / type system (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)
>
> > -thomas
>
> I can do whatever I like I cannot get rid of those 0d0d0a at the end of
> each line in the tmp file! I mounted the filesystem as text and played with
> the CYGWIN env variable. Whenever I redirect multi-line output from a
> standard windows program I get those endings. The tmp file looks like this:
>
> 00000000: 0d0d 0a31 2020 2020 2020 2020 2020 2020 ...1
> 00000010: 2020 2020 2020 200d 0d0a 2d2d 2d2d 2d2d ...------
> 00000020: 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 2d2d 0d0d --------------..
> 00000030: 0a20 2020 2020 2020 2020 2020 2020 2020 .
> 00000040: 2020 2020 2d0d 0d0a 0d0d 0a20 2031 2072 -...... 1 r
> 00000050: 6563 6f72 6428 7329 2073 656c 6563 7465 ecord(s) selecte
> 00000060: 642e 0d0d 0a0d 0d0a
>
> And all I do is "db2 select ... " >tmp
> So why is this so?
>
> -thomas
Thomas,
Windows console programs *do* put 0d0a at line endings irrespective of any
cygwin settings or mounts. If you then redirect the output to a file on a
text-mounted drive, an extra 0d will be added before a 0a (because that's
how text mounts work). You might try piping the output through d2u.
The "extra 0d on console reads" problem that you're having in pdksh is a
separate beast entirely, and yes, it's probably related to the thread you
quoted earlier.
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
Knowledge is an unending adventure at the edge of uncertainty.
-- Leto II
--
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pdksh: problem with read and string compare
@ 2003-04-24 14:41 Thomas Muehlfriedel
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Muehlfriedel @ 2003-04-24 14:41 UTC (permalink / raw)
To: cygwin
Ok, so it is an erroneous line endings problem. The tmp file containing the
output of the external command has line seps of the form 0x0d 0x0d 0x0a.
Does it help if I switch the drive to text-mode since drive e is mounted in
binmode?
muehle@sparrow /cygdrive/e/DataDictionary/report/resource
$ mount
D:\software\cygwin\bin on /usr/bin type system (binmode)
D:\software\cygwin\lib on /usr/lib type system (binmode)
D:\software\cygwin on / type system (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)
-thomas
------------
Who is General Failure and why is he reading my harddisk?
--
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* pdksh: problem with read and string compare
@ 2003-04-24 13:51 Thomas Muehlfriedel
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Muehlfriedel @ 2003-04-24 13:51 UTC (permalink / raw)
To: cygwin
hello all,
I'm using cygwin-1.3.22 with pdksh.
A script developed on linux doesn't run on cygwin because there is a 0xd in
a string I read from standard input.
What happens is the following
A command spits out some multi-line output:
$ . ../script/rep.sh sqlactivity 1.1b
1
--------------------
-
1 record(s) selected.
I read the fourth line ("-") with "read xx" and try to see if it is a "-"
with
if [ $xx = "-" ]
then
bla
else
do something
fi
Under cygwin/win2k this fails because $xx contains "-0x0d". The equality op
doesn't like this and always goes into the else branch.
Has anyone seen this and gotten around somehow? This might actually refer
to the problem reported in
"Erroneous line endings (cat,gawk,text mount)" Still the thread mentioned
did not give me an idea how to solve this problem.
regards
thomas
------------
Who is General Failure and why is he reading my harddisk?
--
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-24 13:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-24 15:07 pdksh: problem with read and string compare Thomas Muehlfriedel
2003-04-24 15:14 ` Igor Pechtchanski
-- strict thread matches above, loose matches on Subject: below --
2003-04-24 14:41 Thomas Muehlfriedel
2003-04-24 13:51 Thomas Muehlfriedel
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).