pdksh: problem with read and string compare

Thomas Muehlfriedel MUEHLE@de.ibm.com
Thu Apr 24 13:51:00 GMT 2003


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/



More information about the Cygwin mailing list