Re: TCL, UNIX, [exec] and lists
From: Paul Pluzhnikov (ppluzhnikov-nsp_at_charter.net)
Date: 31 Dec 2003 15:02:53 -0800
firstname.lastname@example.org (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.
> 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.
-- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email.