Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

append (1t)

Name

append - Append to variable

Synopsis

append varName ?value value value ...?

Description

append(1t)                   Tcl Built-In Commands                  append(1t)



______________________________________________________________________________

NAME
       append - Append to variable

SYNOPSIS
       append varName ?value value value ...?
______________________________________________________________________________

DESCRIPTION
       Append all of the value arguments to the current value of variable var-
       Name.  If varName does not exist, it is given a value equal to the con-
       catenation  of  all the value arguments.  The result of this command is
       the new value stored in variable varName.   This  command  provides  an
       efficient  way  to build up long variables incrementally.  For example,
       "append a $b" is much more efficient than "set a $a$b" if $a is long.

EXAMPLE
       Building a string of comma-separated numbers piecemeal using a loop.

              set var 0
              for {set i 1} {$i<=10} {incr i} {
                  append var "," $i
              }
              puts $var
              # Prints 0,1,2,3,4,5,6,7,8,9,10


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | runtime/tcl-8    |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+

SEE ALSO
       concat(n), lappend(n)

KEYWORDS
       append, variable



NOTES
       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This    software    was    built    from    source     available     at
       https://github.com/oracle/solaris-userland.    The  original  community
       source was downloaded from  http://prdownloads.sourceforge.net/tcl/tcl-
       core8.6.7-src.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.tcl.tk/.



Tcl                                                                 append(1t)