if i define a groovy variable
def x = \"anish$\"
it will throw me error, the fix is
def x = \"anish\\$\"
You can use octal representation. the character $ represents 044 in octal, then: def x = 'anish\044' or def x = 'anish\044'
def x = 'anish\044'
For example, in Java i did use like this: def x = 'anish\044'