delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/15/14:24:57

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
X-VirusChecked: Checked
X-Env-Sender: hkehoe AT budcat DOT com
X-Msg-Ref: server-9.tower-190.messagelabs.com!1284575081!112882211!1
X-StarScan-Version: 6.2.4; banners=budcat.com,-,-
Message-ID: <4C910F64.4060308@budcat.com>
Date: Wed, 15 Sep 2010 13:24:36 -0500
From: Heath Kehoe <hkehoe AT budcat DOT com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.9) Gecko/20100825 Lightning/1.0b2 Thunderbird/3.1.3
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Behaviours of Terminal Versus Script when using "<<"
References: <29720777 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <29720777.post@talk.nabble.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

  On 9/15/2010 12:18 PM, delbydev wrote:
> Hello
> Have hunted all over for this one but it seems no one else has reported the
> issue - maybe because they don't use the feature or there is something awry
> with my installation
>
> I write scripts that dart in and out of databases
>
> I bind my Oracle connection string into a number of variables in my .profile
>
> ORACLE_HOME='c:\\Oracle\\product\\11.2.0\\dbhome_2' export ORACLE_HOME
> mydbconn="${ORACLE_HOME}\\bin\\sqlplus -s mydbuser/mydbpass AT mydbhost" export
> mydbconn
[snip]
> so two questions
> 1) Does the MS CMD Terminal support<<  in scripts  (presently not in my
> installation) - I can't be sure but I think it used to work on older
> environment
> 2) Is minnty a default standard terminal that will ship with all future
> builds of cygwin?

The problem here is not in the << construct. That's a function of the 
bash shell, not the terminal window (cmd, mintty), and works the same 
way in both.

I'll bet the problem is your $mydbconn variable is not set where you're 
trying to run your script. Try this test... in your script, put:

     echo "mydbconn is set to ${mydbconn}." >> /tmp/myresults.txt

And run it. I'll bet you'll see "mydbconn is set to ." which means it's 
empty (not set) when using cmd, and is set when using mintty.

The reason is that you put those variable settings in .profile, which is 
only used in "login" shells; and whether a shell is a "login" shell 
depends on how it is invoked; which can differ depending on the terminal 
window you use and how *that* is invoked.

Try placing your mydbconn and ORACLE_HOME variable settings into .bashrc 
instead of (or in addition to) your .profile; or directly into your script.

-h

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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