Quotes: wrong and right
In the terminalela --spec quotes-wrong-and-right
Each first line is one agents write; the line after it does what they meant.
In "..." a \ starts an escape, and \. or \d is none: ela stops before the run. A regular
expression goes in '...'. There a \ is a backslash, so '\n' is a backslash and an n,
never a line break, and nothing says so:
grep -E "v[0-9]+\.md" files.txt # stops: unknown escape \. in double quotesgrep -E 'v[0-9]+\.md' files.txtt = str.replace($t, 'a\n', "a ") # finds no line break, and $t stays as it wast = str.replace($t, "a\n", "a ")
In "..." a $name is read and a $(cmd) runs, wherever the text is going. Text that holds
them as written goes in ''', or in '...' on one line:
note = "run $(git status) first" # runs git status and puts its output in the notenote = '''run $(git status) first'''
""" and ''' hold nothing on their opening line: the text starts on the next line and ends at
the closing marker on a line of its own.
msg = """fix: the parser # stops: nothing follows """ on its linemsg = """fix: the parser"""
'...' ends on its line and holds no ', and ela has no bash splicing. 'it''s done', in code
or in a command, stops before line 1: two single-quoted texts touch, and a ' can't go inside
one. A ' goes in backticks or in ''', and a backtick in '...'; a command refuses backticks,
so there it is '''. Quotes of different kinds touching stay one word, '--include='"$pat".
In code 'it'"'"'s done' stops with expected end of statement, got a string.
msg = 'it''s done' # stops: two single-quoted texts touch; write `it's done`msg = `it's done`echo 'it''s done' # stops before line 1: in a command the text goes in '''echo ''' it's done '''
(ela --spec strings)