Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lrange(n) [opendarwin man page]

lrange(n)						       Tcl Built-In Commands							 lrange(n)

__________________________________________________________________________________________________________________________________________________

NAME
lrange - Return one or more adjacent elements from a list SYNOPSIS
lrange list first last _________________________________________________________________ DESCRIPTION
List must be a valid Tcl list. This command will return a new list consisting of elements first through last, inclusive. First or last may be end (or any abbreviation of it) to refer to the last element of the list. If first is less than zero, it is treated as if it were zero. If last is greater than or equal to the number of elements in the list, then it is treated as if it were end. If first is greater than last then an empty string is returned. Note: ``lrange list first first'' does not always produce the same result as ``lindex list first'' (although it often does for simple fields that aren't enclosed in braces); it does, however, produce exactly the same results as ``list [lindex list first]'' SEE ALSO
list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n), lset(n), lreplace(n), lsort(n) | KEYWORDS
element, list, range, sublist Tcl 7.4 lrange(n)

Check Out this Related Man Page

lrange(1T)						       Tcl Built-In Commands							lrange(1T)

__________________________________________________________________________________________________________________________________________________

NAME
lrange - Return one or more adjacent elements from a list SYNOPSIS
lrange list first last _________________________________________________________________ DESCRIPTION
List must be a valid Tcl list. This command will return a new list consisting of elements first through last, inclusive. First or last may be end (or any abbreviation of it) to refer to the last element of the list. If first is less than zero, it is treated as if it were zero. If last is greater than or equal to the number of elements in the list, then it is treated as if it were end. If first is greater than last then an empty string is returned. Note: ``lrange list first first'' does not always produce the same result as ``lindex list first'' (although it often does for simple fields that aren't enclosed in braces); it does, however, produce exactly the same results as ``list [lindex list first]'' EXAMPLES
Selecting the first two elements: % lrange {a b c d e} 0 1 a b Selecting the last three elements: % lrange {a b c d e} end-2 end c d e Selecting everything except the first and last element: % lrange {a b c d e} 1 end-1 b c d Selecting a single element with lrange is not the same as doing so with lindex: % set var {some {elements to} select} some {elements to} select % lindex $var 1 elements to % lrange $var 1 1 {elements to} SEE ALSO
list(1T), lappend(1T), lindex(1T), linsert(1T), llength(1T), lsearch(1T), lset(1T), lreplace(1T), lsort(1T) | KEYWORDS
element, list, range, sublist ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTcl | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tcl is available on http://opensolaris.org. Tcl 7.4 lrange(1T)
Man Page

12 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I scroll the terminal output with Expect

Hi, I'm trying to come up with a simple expect script that allows me to login to a system and run a single command ... something like this: #!/usr/bin/expect -f # let's set some variables #set password set ipaddr set ponumber set hostname set timeout -1 # let's now connect to the... (0 Replies)
Discussion started by: danielsf
0 Replies

2. Shell Programming and Scripting

Rlogin / RSH / SSH

Hello, I am looking for a connection method in which i can connect to a remote server but I want to have only one chance to connect to the remote server (not to be asked for iuser name and password again). If I have provided a wrong password then I want the connection to broke and be routed... (1 Reply)
Discussion started by: LiorAmitai
1 Replies

3. Shell Programming and Scripting

su with expect...in a single command?

Hello I am trying su from one user to another in a script. Now the person who runs the script(user) cannot have the password for the user he is su -ing to (webuser) . Here is my script which performs su . This is a hack job based on a few hours of web search. #!/usr/local/bin/expect set... (5 Replies)
Discussion started by: pkabali
5 Replies

4. Red Hat

ssh login using script

Hello All, I am trying to login on server using ssh script & expect.Login to server successful but after login when i hit enter it gets hanged & when pressing CTRL +C it logs me out from the server. Scripts are as below. #!/bin/bash FILE=login.txt CONNECT=sshlogin.exp SERVERNAME=$1... (2 Replies)
Discussion started by: ajaincv
2 Replies

5. Shell Programming and Scripting

help a beginner, expect script, command not found

hi, i have a problem with my expect script, here is MyScript: #!/usr/bin/expect set pass set c set command spawn sudo $command expect "assword" send "$pass\r" expect eof My problem is that when i execute MyScript with the command : "./MyScript mypassword apt-get_install_git"i get... (6 Replies)
Discussion started by: gongotar
6 Replies

6. Shell Programming and Scripting

Expect Script Not working with Crontab

I have the following expect script sitting on a Linux box. === #!/usr/bin/expect -f # # backup.expect # # Expect script to backup a firewall via a SSH session # # set firewall set username set password set prompt set filename match_max 50000 spawn ssh -l... (2 Replies)
Discussion started by: alagondar
2 Replies

7. Shell Programming and Scripting

How to escape Special Characters in Expect programming?

Hi, I have written a unix expect utility "ssh-login.exp" which connects (ssh) to remote host and execute some shell script. I am calling this "ssh-login.exp" utility from another shell script. "ssh-login.exp" takes username, password, host and shell script path to execute on remote host. All... (1 Reply)
Discussion started by: Mahesh Desai
1 Replies

8. Shell Programming and Scripting

Using expect

Hello. I am trying to debug a script of mine. I am using the ssh-copy-id from a script run by root. #!/bin/sh # $1 is user_name $2 is computer adress spawn -noecho ssh-copy-id $1@$2 ] set timeout 20 send_user "ssh-copy-id started\n" while {1} { expect { ^"(Password :)"$... (6 Replies)
Discussion started by: jcdole
6 Replies

9. Shell Programming and Scripting

AIX -/usr/bin/expect shows output Don't know why.

Hi, I have been programming with the expect program for a while now and have create a series of menu driven checks for the operations team. One thing I have noticed is that I call a remote script and pass parameters and this is display on the screen....for example. Within the script ... (0 Replies)
Discussion started by: yakky
0 Replies

10. Shell Programming and Scripting

Special Character issue in Expect Utility (Tcl)

Hi, I have written a unix expect utility "ssh-login.exp" which connects (ssh) to remote host and execute some shell script. I am calling this "ssh-login.exp" utility from another shell script. "ssh-login.exp" takes username, password, host and shell script path to execute on remote host. All... (1 Reply)
Discussion started by: Mahesh Desai
1 Replies

11. Shell Programming and Scripting

Generating a Random String of 'n' length

Hi, How can I generate a string of random characters (alpha+numeric) of a particular length ? For e.g. for n=5, output = 'kasjf' n=10, output = 'hedbcd902k' Also, please let me know if random (valid) dates could also be generated. Thanks (7 Replies)
Discussion started by: rishigc
7 Replies

12. Shell Programming and Scripting

Script to scp every minute with plain password

Hello, I have a Solaris x86 server. I am installing patch cluster on that. Out of so many patches, any one patch is breaking its LDAP authentication and I am not able to figure out, which one is that. I have restored server and planning to apply that patch cluster again. To figure that patch, I... (0 Replies)
Discussion started by: ron323232
0 Replies