TCL - Backslash (backward slash)

About

Tcl uses the backward slash:

  • to indicate the end of a line in a command that spans multiple lines.

Don't add anything after, even a space otherwise you can get this kind of error.

OMB00001: Encountered <EOF> at line: 1, column: 130. Was expecting one of: "OF"
...
    "TO" ...
    .

Use curly braces as the preferred method.

You should consider using the backslash for escaping only in the limited situations that using curly braces results in unmatched braces, the last character of the argument is a backslash, or the element contains a backslash followed by another backslash indicating a new line.

Replacement during the substitution phase

There are specific “Backslash Sequence” strings which are replaced by specific values during the substitution phase. The following backslash strings will be substituted as shown below.

String Output Hex Value
\ Any character immediately following the backslash will stand without substitution.
\a Audible Bell 0x07
\b Backspace 0x08
\f Form Feed (clear screen) 0x0c
\n New Line 0x0a
\r Carriage Return 0x0d
\t Tab 0x09
\v Vertical Tab 0x0b
\0dd Octal Value d is a digit from 0-7
\uHHHH H is a hex digit 0-9,A-F,a-f. This represents a 16-byte Unicode character.
\xHH…. Hex Value H is a hex digit 0-9,A-F,a-f. Note that the \x substitution “keeps going” as long as it has hex digits, and only uses the last two, meaning that \xaa and \xaaaa are equal, and that \xaaAnd anyway will “eat” the A of “And”. Using the \u notation is probably a better idea.

Powered by ComboStrap