Re: TCL, UNIX, [exec] and lists

From: Paul Pluzhnikov (ppluzhnikov-nsp_at_charter.net)
Date: 01/01/04


Date: 31 Dec 2003 15:02:53 -0800

soazine@erols.com (Phil Powell) writes:

> exec tar zcf $tarFileName [string range $fileList 0 end]

Since "[string range $a 0 end]" is by definition identical to $a,
you might as well write this as

   exec tar zcf $tarFileName $fileList

> It apparently thinks the file name is all of $fileList, it doesn't
> seem to know that I am importing $fileList as a list of string values.

Right.

> TCL knows what it is, but TAR does not.

TCL exec command will pass each argument separately (as if the values
are single-quoted after the variable expansion). To make it do what
you want, change it to:

   eval exec tar zcf $tarFileName $fileList

Be careful not to have any spaces or TCL-special characters in
either $tarFileName or $fileList.

Cheers,

-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


Relevant Pages

  • Re: TCL, UNIX, [exec] and lists
    ... > seem to know that I am importing $fileList as a list of string values. ... eval exec tar zcf $tarFileName $fileList ... In order to understand recursion you must first understand recursion. ...
    (comp.lang.tcl)
  • Re: TCL, UNIX, [exec] and lists
    ... > seem to know that I am importing $fileList as a list of string values. ... eval exec tar zcf $tarFileName $fileList ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.misc)