This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sqlplus and end-of-line problem in shell script code


Hi,
I want to use our shell script collection which includes sqlplus calls
under Cygwin.
I have the following problem with this code snippet:

#!/bin/bash

RESULT=`sqlplus -s myuser/mypasswd@MYDB <<EOF
SET FEEDBACK OFF;
SET PAGESIZE 0;
SELECT '42' FROM DUAL;
EOF`

if test "$RESULT" = "42" ; then
echo "Result is 42..."
else
echo "Result is not 42 ??!"
fi

When I run the script on UNIX it prints "Result is 42..." which is OK.
When I run the script under Cygwin the result is: "Result is not 42??!"
The reason is that under Cygwin the result of the SELECT are 3
characters "42" "CR" "LF" (instead of 2 characters "42" and "LF").
I did not found a way to convince sqlplus to produce UNIX-EOLs on
Windows. Does anyone know how to solve the problem without changing
the code itself ?

Best regards,
Thomas

-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]