diff options
Diffstat (limited to 'doc/set.n')
-rw-r--r-- | doc/set.n | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -14,13 +14,12 @@ set \- Read and write variables .SH SYNOPSIS \fBset \fIvarName \fR?\fIvalue\fR? .BE - .SH DESCRIPTION .PP Returns the value of variable \fIvarName\fR. If \fIvalue\fR is specified, then set the value of \fIvarName\fR to \fIvalue\fR, creating a new variable -if one doesn't already exist, and return its value. +if one does not already exist, and return its value. If \fIvarName\fR contains an open parenthesis and ends with a close parenthesis, then it refers to an array element: the characters before the first open parenthesis are the name of the array, @@ -42,7 +41,7 @@ unless \fIvarName\fR was declared to resolve differently through one of the .SH EXAMPLES Store a random number in the variable \fIr\fR: .CS -\fBset\fR r [expr rand()] +\fBset\fR r [expr {rand()}] .CE .PP Store a short message in an array element: @@ -65,9 +64,7 @@ practice instead of doing double-dereferencing): \fBset\fR vbl in[expr {rand() >= 0.5}] \fBset\fR out [\fBset\fR $vbl] .CE - .SH "SEE ALSO" expr(n), global(n), namespace(n), proc(n), trace(n), unset(n), upvar(n), variable(n) - .SH KEYWORDS read, write, variable |