Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning a list from a command????

Status
Not open for further replies.

rajab57

Programmer
Jan 2, 2001
1
JP
Hi,

I want to execute the below mentioned line.

set namelist [report_names -spec {ABC }]
eg:
the command [report_names -spec {ABC }] returns a list as shown below:

abcd
tom
vicky
Mary
and I want this list to be copied into namelist.

here report_names is a user defined command that returns a list of names and I want the list of names to copied into the list namelist.But the output seems to printed on the screen instead of getting copied into the variable namelist.
Can somebody suggest me what can be done to solve this.

Thank you.
 
tclsh
% proc report_names {args} {
return [list abcd tom vicky Mary]
}
% set namelist [report_names -spec {ABC }]
abcd tom vicky Mary
% set namelist
abcd tom vicky Mary


The list is copied to the terminal when the set command is issued because the result of the set command itself is the value that was assigned - but it still gets assigned to the variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top