Escape backquote in a double-quoted string in shell
问题 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 ` 回答1: You need to escape the backtick, but also escape the backslash: $ touch 1\` $ /bin/sh -c "ls 1\\\`" 1` The reason you have to escape it "twice" is