Behaviours of Terminal Versus Script when using "<<"

Heath Kehoe hkehoe@budcat.com
Wed Sep 15 21:41:00 GMT 2010


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



More information about the Cygwin mailing list