For the command: /usr/bin/sh -c "ls 1`" (a backquote after 1).
How to make it run successfully? Adding a backslash before "`" does not work. ` is a special char as we know, and I tried surrounding it with single quote too (/usr/bin/sh -c "ls 1'`'"), but that doesn't work either.
The error always are:
% /usr/bin/sh -c "ls 1\`"
Unmatched `
Use single quotes instead:
You need to escape the backtick, but also escape the backslash:
The reason you have to escape it "twice" is because you're entering this command in an environment (such as a shell script) that interprets the double-quoted string once. It then gets interpreted again by the subshell.
You could also avoid the double-quotes, and thus avoid the first interpretation:
Another way is to store the filename in a variable, and use that value:
And finally, what you tried will work on some shells (I'm using bash, as for the above examples), just apparently not with your shell:
I strongly suggest you avoid such filenames in the first place.