Snippets and Shell $vars


I do a lot of shell scripting and I am attempting to populate my snippets.

While I have simple snippets working I have found that I cannot populate my snippets with $N as these are used to define snippet behaviour. Can someone please tell me how I can delimit my own shell vars so they are not stripped from the snippet.

'prefix': 'shellalert'
'body': 'alert() {\n\t# Usage: alert <$?> <object>\n\tif [ "$1" -ne 0 ]'

The above snippet is for a simple alert function. The $1 in the above is stripped when invoked.

Thanks in advance.


I haven’t tried this, but have you tried prefixing the $ with a backslash or other common escape character?


I have and it did not work unfortunately.

 "\$1" does not delimit the $. 

Note the:

Usage: alert <$?>

Displays just fine with no delimiters so its the combination of $ and int that seems to be causing the issue.