Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A way to `unlist' a list ?

147 views
Skip to first unread message

Gert

unread,
Jul 3, 1999, 3:00:00 AM7/3/99
to
Hi,

I wonder if there is a way to unlist a list ...
I am very new to Tcl, but this is the case:

I have a proc with `args' as the last arg, and I want that list to be executed
by exec. Exec however wants the arguments to the program as arguments to exec,
so:
set output [exec $args]
won't work if args is (for example) "ls -l" :(

Is there a way to expand the "ls -l" to a "ls" "-l" ??

Thanx,

Gert
--
_______________________________________________________________________________
~ Gert, Gs2, The Blue Mage - whatever you prefer
'v' E-Mail : G...@dds.nl
// \\ Computer : nowmoo.demon.nl
/( )\ Project : gMOO, a MOO (and MUD) client for the unises
^`~'^ HomePage : http://www.nowmoo.demon.nl

Gerald W. Lester

unread,
Jul 3, 1999, 3:00:00 AM7/3/99
to
Gert wrote:

> Hi,
>
> I wonder if there is a way to unlist a list ...
> I am very new to Tcl, but this is the case:
>
> I have a proc with `args' as the last arg, and I want that list to be executed
> by exec. Exec however wants the arguments to the program as arguments to exec,
> so:
> set output [exec $args]
> won't work if args is (for example) "ls -l" :(
>
> Is there a way to expand the "ls -l" to a "ls" "-l" ??

Check out the eval command

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester | "The man who fights for his ideals is |
| gerald...@mtolive-lcms.org | the man who is alive." -- Cervantes |
| Webmaster for http://www.mtolive-lcms.org |
+--------------------------------+---------------------------------------+

Cameron Laird

unread,
Jul 3, 1999, 3:00:00 AM7/3/99
to
In article <377D8343...@home.com>,

Gerald W. Lester <gwle...@home.com> wrote:
>Gert wrote:
>
>> Hi,
>>
>> I wonder if there is a way to unlist a list ...
>> I am very new to Tcl, but this is the case:
>>
>> I have a proc with `args' as the last arg, and I want that list to be executed
>> by exec. Exec however wants the arguments to the program as arguments to exec,
>> so:
>> set output [exec $args]
>> won't work if args is (for example) "ls -l" :(
>>
>> Is there a way to expand the "ls -l" to a "ls" "-l" ??
>
>Check out the eval command
.
.
.
Gerald's right. For details, see <URL:
http://starbase.neosoft.com/~claird/comp.lang.tcl/fmm.html#ls>.
--

Cameron Laird http://starbase.neosoft.com/~claird/home.html
cla...@NeoSoft.com +1 281 996 8546 FAX

Mike

unread,
Jul 6, 1999, 3:00:00 AM7/6/99
to
g...@nowmoo.demon.nl (Gert) wrote in
<377D6BA1...@nowmoo.demon.nl>:

>I have a proc with `args' as the last arg, and I want that list to
>be executed by exec. Exec however wants the arguments to the
>program as arguments to exec, so:
> set output [exec $args]
>won't work if args is (for example) "ls -l" :(

Try set output [eval exec $args]

0 new messages