bash ignores escaped $ and says "bad substitution"

Can someone tell me how to get the version of bash that I am running?

I'm running cygwin bash on Windows XP at home and cygwin bash on Vista at work.

Is this the version number for bash?
$ uname -a
CYGWIN_NT-6.0 US-SEA-L3BER9K 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin

This is the version at work that does not work.

Here is the command that works at home but not at work:

$ groovy -e " (new XmlSlurper().parse('languages.xml')).language.each { println \"\${it.@name} authored by \${it.author[0].text()}\" } "
/cygdrive/c/Program Files/Groovy/Groovy-1.6.4/bin/startGroovy: line 229: ${it.author[0].text()}" } ": bad substitution

Now who is complaining about the substitution: bash or groovy?

Why is bash complaining about a bad substitution? I escaped the "$" so bash would ignore it and this works at home. I tried "\\$" but that did not help! I want groovy to do the substitution, not bash.

The bash at work is a recent installation (August 2009). The bash at home was last updated a while ago, maybe spring 2009?

Hmmm... now that I am re-reading my own post I'm wondering if this is a groovy issue, not a bash issue. I'm trying to figure how how to delete this post...

Thanks,
Siegfried

Hi.

You should be able to get the bash version by using

bash --version

uname has nothing to do with the version of bash. It shows information about the kernel revision, etc.

I would say that groovy is the one complaining, because you've quoted the string, and escaped everything else, there is no reason why bash should complain.

Simple test (sorry, I don't have groovy):

X=" (new XmlSlurper().parse('languages.xml')).language.each { println \"\${it.@name} authored by \${it.author[0].text()}\" } "
(no error)

echo $X

(new XmlSlurper().parse('languages.xml')).language.each { println "${it.@name} authored by ${it.author[0].text()}" }

I know it may seem odd, but I got a similar error having dumped a script from Red Hat to Vista, edited it and passed it back again; CR/LF issues with the SCP transfer.

If you 'cat -vet' the file on both systems, does the output look the same?