echo
The echo command prints a line of text to standard output while James reads the script.
Syntax
echo <text>
text is the rest of the line, exactly as written. Comment markers ($, #, c) and %name or [expr] forms inside it are part of the text and are not interpreted.
What it does
James prints the text and a newline to standard output, in full. Nothing in the text is shortened, and the text is not stored in the IR or in the mesh file. The text prints in script order as James reads the script, before any part is meshed, because the engine meshes only after the whole script is read.
When James applies it
When it is read. It is legal in any phase: Control, Part or Merge.
Rules James adds
- The text is raw: it runs to the end of the physical line, and a
$, a#or acinside it does not start a comment (docs/feature-specs/lexical-rules.md, the raw-text rule). A line holdinga $ b # c %x [1+1]prints unchanged. - James prints the whole text. It enforces no length limit on it.
Diagnostics
- None: James raises no diagnostic for
echo.
Example
The script tests/corpus/110-session-commands-inert/input.tg, which make test runs:
errmod 0
echo hello world
becho beep and text
caption cap Test Caption
block 1 2;1 2;1 2;0 1;0 1;0 1;
endpart
James prints hello world on standard output when it reads line 2, then beep and text for the becho on line 3. The errmod, caption and block lines print nothing, and the IR holds one part.
See also
- becho: the same command under its other name; James drops its bell.
- title: the one text command whose text James stores.
- Writing a script: comments and the raw-text commands.