Wanted: Help with escaping bash command line arguments

Please forgive me if this is the wrong forum. I want to execute some one liners with the groovy programming language and I'm having trouble escaping the special characters to accommodate bash.

Here is one of the lines that is giving me trouble:

groovy -e  "(new XmlParser().parse('languages.xml')).each{ println \"${it.@name} authored by ${it.author[0].text()}\" } "

I've tried putting single backslashes in front of the $'s and double and nothing seems to work. I get this error:

./UsingXMLParser.bash: line 50: (new XmlParser().parse('languages.xml')).each{ println "\\${it.@name} authored by \\${it.author[0].text()}" } : bad substitution

Groovy is free to install if you need to try it out. When I run the statements directly in the groovy console, they execute so I have the basic syntax correct and the problem is just keeping bash happy.

Can someone show me the correct syntax? Incidently, it seems that perl was inspired by bash or sh and groovy is inspired by perl and all three languages use the "${xyx}" syntax for variable interpolation in a quoted string to indicate that xyz is not a literal but a variable.

Thanks
Siegfried

try this..

 
groovy -e  '(new XmlParser().parse(\'languages.xml\')).each{ println "${it.@name} authored by ${it.author[0].text()}" }'