3

I'm trying to search for parameterized strings of the form "${foo}".

ag "${" and ag "\${" return nothing. How do you escape the "$"?

1 Answer 1

6

This was answered on their github page:

Since you're using double quotes, you're only escaping the dollar sign from the shell. By the time ag sees it, it is an unescaped dollar sign and therefore interpreted as end of line. Try single quotes or proper escaping:

$ ag '\$timeout'

$ ag "\\\$timeout"

The reason grep is not affected, is because it uses basic regular expressions by default. With -E it behaves the same.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .