info complete
Tells if a script has no open brace, bracket, or quote.
info complete SCRIPT
Description
Gives 1 when each brace, bracket, and double quote of SCRIPT that opens a word or a substitution has its end, and 0 when one is open. A backslash and a newline at the end continue the command, so they give 0. An empty SCRIPT is complete. A close brace or a close bracket with no open one is complete, and so is a comment.
A shell uses it to tell when the lines that it read are a full command.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| SCRIPT | script | required | The text to test. |
Returns
1 or 0.
Examples
% info complete {set x 1}
1
% info complete "set x \{"
0
% info complete {set x [list a}
0
% info complete "list \"a"
0
% info complete "a \\\n"
0
% info complete "# \{"
1
% info complete {}
1
Errors
% info complete
wrong # args: should be "info complete command"
-errorcode TCL WRONGARGS
% info complete a b
wrong # args: should be "info complete command"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1