Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lappend(3tcl) [debian man page]

lappend(3tcl)						       Tcl Built-In Commands						     lappend(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
lappend - Append list elements onto a variable SYNOPSIS
lappend varName ?value value value ...? _________________________________________________________________ DESCRIPTION
This command treats the variable given by varName as a list and appends each of the value arguments to that list as a separate element, with spaces between elements. If varName does not exist, it is created as a list with elements given by the value arguments. Lappend is similar to append except that the values are appended as list elements rather than raw text. This command provides a relatively efficient way to build up large lists. For example, "lappend a $b" is much more efficient than "set a [concat $a [list $b]]" when $a is long. EXAMPLE
Using lappend to build up a list of numbers. % set var 1 1 % lappend var 2 1 2 % lappend var 3 4 5 1 2 3 4 5 SEE ALSO
list(3tcl), lindex(3tcl), linsert(3tcl), llength(3tcl), lset(3tcl), lsort(3tcl), lrange(3tcl) KEYWORDS
append, element, list, variable Tcl lappend(3tcl)

Check Out this Related Man Page

list(3tcl)						       Tcl Built-In Commands							list(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
list - Create a list SYNOPSIS
list ?arg arg ...? _________________________________________________________________ DESCRIPTION
This command returns a list comprised of all the args, or an empty string if no args are specified. Braces and backslashes get added as necessary, so that the lindex command may be used on the result to re-extract the original arguments, and also so that eval may be used to execute the resulting list, with arg1 comprising the command's name and the other args comprising its arguments. List produces slightly different results than concat: concat removes one level of grouping before forming the list, while list works directly from the original arguments. EXAMPLE
The command list a b "c d e " " f {g h}" will return a b {c d e } { f {g h}} while concat with the same arguments will return a b c d e f {g h} SEE ALSO
lappend(3tcl), lindex(3tcl), linsert(3tcl), llength(3tcl), lrange(3tcl), lrepeat(3tcl), lreplace(3tcl), lsearch(3tcl), lset(3tcl), | lsort(3tcl) KEYWORDS
element, list Tcl list(3tcl)
Man Page

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

A basic question of FOR loop

Hi, have a basic query. Please see the below code: list="one two three" for var in $list ; do echo $var list="nolist" Done Wht if I want to print only first/ last line in the list Eg one & three Regards er_ashu (3 Replies)
Discussion started by: er_ashu
3 Replies

2. Shell Programming and Scripting

>> append formatting

var=$(find /etc/*) tput smso ls -l | echo $var >> log i am losing at the formatting when i append it to the log is another way of doing it (1 Reply)
Discussion started by: jafa401
1 Replies

3. UNIX for Dummies Questions & Answers

Appending error

Hi All, I just want to append the value in variable at the end of the file. var=1234 sed -e "$a $var" file1 > file 2. But I get this error sed: -e expression #1, char 4: unknown command: `1' Kindly let m know how can I do that... (5 Replies)
Discussion started by: waqar1
5 Replies

4. UNIX for Dummies Questions & Answers

Apending a list of users to a file

Hi guys, As part of my UNIx homework, I have created a file named dir_listing, which is based within directories. This file already contains the root directory root_dir. I am now required to append a list of users to dir_listing. i can obtain the list by simply typing users, but how would I... (1 Reply)
Discussion started by: Jimmy_c
1 Replies

5. UNIX for Dummies Questions & Answers

appending running numbers on a variable

hi guys, would appreciate some help here. I need to append running numbers using sed onto a variable that contain a list of IP addresses. I'm basically stuck on the running number part. e.g. 1. 10.0.0.1 2. 10.0.0.2 3. 10.0.0.3 (10 Replies)
Discussion started by: jazzaddict
10 Replies

6. Shell Programming and Scripting

Append text error?

Sup guys, today I tried to append a string from my text by asking the user to input and change the specific text they wanna append. The problem is that, the code looks logically correct, but when I run it there's an error somewhere. Can anyone identify for me? echo "Search data" read... (4 Replies)
Discussion started by: aLHaNz
4 Replies

7. Shell Programming and Scripting

append to same string variable in loop

I want to append values to same string variable inside a recursive function that I have .. I do not want to write to any file but use a variable.. Can anyone please help with it? Thanks in advance. (6 Replies)
Discussion started by: Prev
6 Replies

8. Shell Programming and Scripting

Trimming spaces from a variable

Hi guys, when I take substring of a particular data using this command var=substr($0,11,10) it comes with spaces, when I am trying to trim the spaces it is not allowing me to do that. Can you please help me out on that. As I have to reverse the output of the variable also. ---------- Post... (0 Replies)
Discussion started by: manish8484
0 Replies

9. OS X (Apple)

File paths with spaces in a variable

Hi all my very first post so go easy on me!! I am trying to build a very simple script to list a file path with spaces in. But I can't get around this problem. My script is as follows: #!/bin/bash X="/Library/Users/Application\ Support/" LS="ls" AL="-al" $LS $AL $X The response I... (5 Replies)
Discussion started by: tillett22
5 Replies

10. Shell Programming and Scripting

How to Append data to the content at the beginning of a variable?

Hi Guys, IF i have to append data to a variable, i simply use the following. What can i do to append data to the beginning? VAR+="data" (6 Replies)
Discussion started by: srkmish
6 Replies