delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/10/02/07:27:51

X-Spam-Check-By: sourceware.org
Date: Mon, 2 Oct 2006 13:27:29 +0200
From: Thomas Porschberg <thomas DOT porschberg AT osp-dd DOT de>
To: "Peter A. Castro" <doctor AT fruitbat DOT org>
Cc: mwoehlke <mwoehlke AT tibco DOT com>, cygwin AT cygwin DOT com
Subject: Re: sqlplus and end-of-line problem in shell script code
Message-ID: <20061002132729.30e37e47@porschberg.osp-dd.de>
In-Reply-To: <Pine.LNX.4.63.0609291001160.2621@gremlin.fruitbat.org>
References: <20060929102628 DOT 49430820 AT porschberg DOT osp-dd DOT de> <efjcsl$iii$1 AT sea DOT gmane DOT org> <20060929180634 DOT 53341dd9 AT porschberg DOT osp-dd DOT de> <Pine DOT LNX DOT 4 DOT 63 DOT 0609291001160 DOT 2621 AT gremlin DOT fruitbat DOT org>
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-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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 think I found the problem.
A college of me did not update its cygwin packages for a long time.
And my script was working at his cygwin environment.
Then he updated to the recent packages and to the recent bash.
And my script did not work any longer !

So it seems to be a problem with the new bash.

Thomas

Am Fri, 29 Sep 2006 10:09:45 -0700 (PDT)
schrieb "Peter A. Castro" <doctor AT fruitbat DOT org>:

> On Fri, 29 Sep 2006, Thomas Porschberg wrote:
> 
> Check your mounts.  See if you have /tmp mounted in textmode.
> Also, check if the filesystem you are running the script from is
> mounted in textmode or not and weither the CYGWIN env var has
> textmode on binmode set.  Try playing around with textmode &
> binmode.  Read the cygwin doc concerning text translation:
> 
> http://cygwin.com/cygwin-ug-net/highlights.html#ov-hi-textvsbinary
> http://cygwin.com/cygwin-ug-net/using-textbinary.html
> http://cygwin.com/cygwin-ug-net/using-cygwinenv.html
> 
> > Am Fri, 29 Sep 2006 10:08:04 -0500
> > schrieb mwoehlke <mwoehlke AT tibco DOT com>:
> >
> >> Thomas Porschberg wrote:
> >>> 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 ?
> >>
> >> Um, if by "the code" you meant the above script, then no. Otherwise
> >> it looks like you could drop a '| d2u' (or '| sed s/\r//g') in
> >> there. I forget though if you want:
> >>
> >> RESULT=`app | d2u << EOF
> >> input
> >> EOF`
> >>
> >> or
> >>
> >> RESULT=`app << EOF
> >> input
> >> EOF | d2u`
> >>
> >> ...or possibly neither. At any rate, that's a question of shell
> >> syntax; get that right and it seems it should work.
> >>
> > I think the basic question is:
> > When a Windows program called from cygwin writes a CR-LF as EOL
> > (and I think sqlplus is simply doing that) is it possible via
> > cygwin to remove the CR before assigning the value to a shell
> > variable.
> > Because Dr. Volker Zell reported about an successful run of
> > the script it should possible.
> >
> > Regards,
> > Thomas P.
> >
> >
> 


-- 


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