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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)