This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: newbie bash variable problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]