delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/29/04:26:53

X-Spam-Check-By: sourceware.org
Date: Fri, 29 Sep 2006 10:26:28 +0200
From: Thomas Porschberg <thomas DOT porschberg AT osp-dd DOT de>
To: cygwin AT cygwin DOT com
Subject: sqlplus and end-of-line problem in shell script code
Message-ID: <20060929102628.49430820@porschberg.osp-dd.de>
X-Mailer: Sylpheed-Claws 2.1.0 (GTK+ 2.8.3; i686-suse-linux-gnu)
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019