X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 	tests=AWL,BAYES_00,UNPARSEABLE_RELAY
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: mjD.OBqswBAPbVUxYJaYPvc61jLEnpq8VnBwJGdbEJOPA9xw
Message-ID: <4B53B2BE.3020402@sbcglobal.net>
Date: Mon, 18 Jan 2010 01:00:46 +0000
From: Greg Chicares <gchicares@sbcglobal.net>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: newbie bash variable problem
References: <4B53A0DC.5050708@gmail.com>
In-Reply-To: <4B53A0DC.5050708@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 2010-01-17 23:44Z, brian wrote:
> 
> $JAVA_HOME is the env variable which  I can echo from the script as  
> /cygdrive/c/jdk1.6.0_16
> 
> but the script sets
> 
> JAVA=$JAVA_HOME/bin/java/

My guess is that the script contains carriage returns.
To look for them, use 'od'. To remove them, use 'd2u'
or 'dos2unix' if you've got them, else 'tr'.

> I want to see if this is set right so I set an echo this in the script
> 
> echo JAVA
> 
> but this just gives "JAVA"
> 
> and this
> 
> echo $JAVA
> 
> /bin/java/c/jdk1.6.0_16
> 
> which some how over writes part of the variable.

This:
  /cygdrive/c/jdk1.6.0_16<cr>
  /bin/java
displays thus:
  /bin/java/c/jdk1.6.0_16<cr>

$echo "/cygdrive/c/jdk1.6.0_16\r/bin/java"
/bin/java/c/jdk1.6.0_16

$echo "/cygdrive/c/jdk1.6.0_16\r/bin/java" |od -t a
0000000   /   c   y   g   d   r   i   v   e   /   c   /   j   d   k   1
0000020   .   6   .   0   _   1   6  cr   /   b   i   n   /   j   a   v
0000040   a  nl

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

