delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/17/20:01:03

X-Recipient: archive-cygwin AT delorie DOT 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 AT sbcglobal DOT net>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: newbie bash variable problem
References: <4B53A0DC DOT 5050708 AT gmail DOT com>
In-Reply-To: <4B53A0DC.5050708@gmail.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 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

- Raw text -


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