M
M
mirus2014-09-23 08:52:50
bash
mirus, 2014-09-23 08:52:50

How to escape single quotes in bash?

How to escape single quotes in bash? I need to sudo "sed -i '1!d' path" over ssh in this form via a bash script, but the backslash does not escape the single quote character.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2014-09-23
@jcmvbkbc

backslash does not escape single quote character

oh well, it doesn't escape:
$ ssh 192.168.0.1 "printf '>>>%s<<<\n' \'"
>>>'<<<
$

S
ShamblerR, 2015-02-18
@ShamblerR

sed -i 's/                \x22IBLOCK_ID\x22 => \x2233\x22\x2C/                \x22IBLOCK_ID\x22 => \x22GOTOVO\x22\x2C/g' {} \;^C

By analogy, understand
\x27

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question