Escaped shell variable in pipeline config

Hi,
I want to have a string with escaped shell variable passed as an option to some executable in the pipeline, consider the
following example:
binary --pattern "\$1 == \"On network\" || \$NF == \"On network\" || \$0 ~ /.On network./"

However, I cannot find a way to escape $ and preserve a backslash before it. Both \$$ and \\$ in the pipeline configuration doesn’t seem to work. Is there a way to do such a thing?

Hi Roman,

I think there is one missing \ from \$$ for this to work:

binary --pattern "\\$$1 == \"On network\" || \\$$NF == \"On network\" || \\$$0 ~ /.On network./"

Please let me know if that does not do it!

Cheers,
Juanito

I’ve tried "\\$$1 == \"On network\" || \\$$NF == \"On network\" || \\$$0 ~ /.On network./" as well, and looks like it evaluates to:
--pattern "\\$1 == \"On network\" || \\$NF == \"On network\" || \\$0 ~ /.On network./", which is still invalid:(

Using single quotes instead of double seems to remove the necessity to escape $ and ", so
the following works:

--pattern '\$1 == "On network" || \$NF == "On network" || \$0 ~ /.On network./'

wonderful!!! I was off digging for a solution but you beat me to it!