Behaviours of Terminal Versus Script when using "<<"

Thu Sep 16 08:44:00 GMT 2010

Hello Heath

Thanks for the heads up - 
There was no .bashrc - so created one - but it does not appear to execute
when creating a new cygwin bash shell (via cmd interface)

So I dropped a call to .profile in the script
. ~/.profile

This resolves the issue - it appears that a script executed within the shell
does not inherit the variables bound within the main shell.  The mintty
terminal appears to behave normally and does reuse the variables already
bound within the shell environment.

Not ideal as I will have scripts that call further scripts. 
Thanks for the advice
-/ D

Heath Kehoe wrote:
>   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 
> ______________________________________________________________________
> --
> Problem reports:
> FAQ:         
> Documentation:
> Unsubscribe info:

View this message in context:
Sent from the Cygwin list mailing list archive at

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list