reasons against exec:
could not output error in real time, which is a vital requirement
for my case because stderr contained progress information.
reasons against pipe:
In case of pipe, open "|xxx | yyy |& cat" could offer TCL script
real time stderr output of the last command in the pipe, but it is
the stderr outupt of the first command that I am interested in.
Plus, I am not sure how to properly escape file names that I pass
to 'open "|"', as the file name may contain single-quote ("Mum's
Lunch.odt") and double-quote (Oliver "Ollo" Twist.txt), it seems
much easier for exec.
So it seems I cannot use neither. 3rd option is to write a shell script
that contains the pipe (open "|sh -c '$cmd'" is more likely cause
trouble with file names with quote). 4th option is to handle the pipe
with TCL (low efficiency). What would you do?
Thanks for advices in advance!
Neither or a problem, just have the file names in variables and do:
set fd [open "|xxx $fn(1) $fn2" ...]
> So it seems I cannot use neither. 3rd option is to write a shell script that
> contains the pipe (open "|sh -c '$cmd'" is more likely cause trouble with
> file names with quote). 4th option is to handle the pipe with TCL (low
> efficiency). What would you do?
Reread the Endekalogue until I understand it.
--
+------------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+------------------------------------------------------------------------+
Create the command as a *list*
set arg1 "Mum's Lunch.odt"
set arg2 {Oliver "Ollo" Twist.txt}
set cmd [list cmd $arg1 $arg2 $arg3]
set fd [open "|$cmd" ... ]
'open' parses its first arg as a list in the case of a pipeline, so any
spaces etc are conserved if you use 'list' to construct it.
R'
Thanks!