anordal / shellharden

The corrective bash syntax highlighter
Mozilla Public License 2.0
4.62k stars 129 forks source link

description of single quoting behaviour seems wrong #14

Closed wbolster closed 6 years ago

wbolster commented 6 years ago

the document currently contains:

The simplest is to go for single quotes, since these have the simplest escaping rules – only one: ' → '\''.

this seems incorrect. backslashes do not escape anything inside single quotes::

\

that also means that this is an incomplete command, as can be seen from the continuation prompt:

$ echo '\''
> 
> ^C

the correct approach is to replace ' with '"'"' which looks horrible, but is correct:

anordal commented 6 years ago

You have to actually quote the string as well. Example:

echo 'Don'\''t stop (12" dub mix).mp3'

So I'm actually proposing the same as you, exept using '\'' instead of '"'"'. Agree?

I guess I should have added an example. Any other way I could make it clearer?

wbolster commented 6 years ago

aaaah, now i see.

image

somehow i totally missed the single quotes in the replacement string while reading this. sorry about that.

i guess an example would help, yeah.