title: Call a unix program from a TCL variable
body: <p>My TCL script puts together a call to a command line tool using TCL variables.
  I've tried exec or eval for the command line but nothing worked.</p>
  
  <pre><code>#!/usr/bin/tclsh
  set dbg 0
  set iso 100
  set cmd "gphoto2 --set-config-value /main/imgsettings/iso=${iso}"
  if {$dbg} {puts $cmd} else {eval $cmd}
  </code></pre>
  
  <p>Gives :</p>
  
  <pre><code>invalid command name "gphoto2"
  while executing
  "gphoto2 --set-config-value /main/imgsettings/iso=100"
  ("eval" body line 1)
  invoked from within
  "eval $cmd"
  invoked from within
  "if {$dbg} {puts $cmd} else {eval $cmd}"
  (file "./canon.tcl" line 22)
  </code></pre>
  
  <p>If tried <code>{ exec $cmd }</code> but that did not work either.</p>
  
  <pre><code>couldn't execute "gphoto2 --set-config-value /main/imgsettings/iso=100": no such file or directory
  while executing
  "exec $cmd"
  invoked from within
  "if {$dbg} {puts $cmd} else {exec $cmd}"
  (file "./mofi_canon.tcl" line 22)
  </code></pre>
  
  <p>I tried giving absolute path name <code>/usr/bin/gphoto2</code> but again no success.
  I guess the problem has to do with the entire command string being one object and the unix execution cannot parse it. But what's the way to give it to the shell properly?</p>
  
  <p>from the linux command line of course the command works fine.</p>
  
  <pre><code>@ubuntu:~/TCL$ gphoto2 --summary                                        
  Camera summary:                                                                
  Manufacturer: Canon Inc.
  Model: Canon EOS DIGITAL REBEL XSi
  </code></pre>
  
  <p>This is from a kubuntu 14.04 linux.</p>
  
  <pre><code>uname -a
  Linux ubuntu 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
  </code></pre>
  
  <p>Thanks &amp; Cheers,
  Gert</p>