Bash tries to expand the dollar/variable expression since the dollar is
not escaped:
$ echo "${it@name}"
bash: ${it@name}: bad substitution
In most cases it's the simplest to use outer single quotes and inner
double quotes since the shell doesn't expand strings in single quotes:
$ groovy -e '(new XmlParser().parse("languages.xml")).each{ println
"${it.@name} authored by ${it.author[0].text()}" }'
but it gets nasty if you need inner single quotes:
groovy -e '(new XmlParser().parse('\''languages.xml'\'')).each{
println "${it.@name} authored by ${it.author[0].text()}" }'
Otherwise quote the double quotes and the dollars:
groovy -e "(new XmlParser().parse('languages.xml')).each{ println
\"\${it.@name} authored by \${it.author[0].text()}\"}"
Regards,
Volker