problem with running tcl/tk scripts

d gitelman
Mon Jan 15 07:03:00 GMT 2007

Dear Cygwin
I apologize if this issue has been posted but I searched and could not find
a solution.
I am using a software package called FSL from It is made to
run within cygwin on windows. It uses tcl/tk for its gui, and a problem
occurs with the GUI only with cygwin1.dll 1.5.19 and greater. 1.5.18 worked
fine. Here is the code in question.
A GUI is set up with a series of buttons: 
if { [ file exists ${FSLDIR}/tcl/fdt.tcl ] } {
     button $w.f1.fdt -text "FDT Diffusion" \
             -command { exec sh -c "${FSLDIR}/bin/Fdt$gui_ext" & }
     pack $w.f1.fdt -in $w.f1 -fill x -padx 1 -pady 1
The global variables above expand to:
${FSLDIR}  = /usr/local/fsl
$gui_ext   = _gui

so pressing the button should execute: exec sh -c /usr/local/fsl/bin/Fdt_gui
instead nothing happens.

Fdt_gui is actually a link to a file
   Fdt_gui -> Runtcl

and the code in Runtcl is: 


  # Check for display being set \
  if [ _`uname | grep CYGWIN` = _ -a _$DISPLAY = _ ] ; then echo "DISPLAY is
not set. Please set your DISPLAY environment variable!" ; exit 1 ; fi

  # the next line restarts using wish \
  if [ _$FSLWISH = _ ] ; then echo "You need to source an FSL setup file -
either or fsl.csh in \$FSLDIR/etc/fslconf !" ; exit 1 ; else exec $FSLWISH
  -- "$@" ; fi

  set FSLDIR $env(FSLDIR)

  set origname [ string tolower [ file tail [ info script ] ] ]

  set UNAME [ exec uname ]
  if { $UNAME == "Darwin" || [ string compare CYGWIN [ string range $UNAME 0
5 ] ]
   == 0 } {
      regsub "_gui" $origname "" origname

  source ${FSLDIR}/tcl/${origname}.tcl


so what should happen is that it should source the .tcl file

Note: all the files are present. If I type: wish /usr/local/fsl/tcl/fdt.tcl
the appropriate dialog appears.

Also, if I use an older version of cygwin (1.5.18-1) the exact same
installation of fsl with the above code runs fine. The older version of
cygwin is installed in its own directory.

Interestingly other buttons that reference actual .exe files work fine in
the new version. So if instead of Fdt_gui the line referenced a .exe file
the button works (must be an actual .exe file, changing the filename to
Fdt_gui.exe does not work).

If I try to execute the following command from the bash shell I get the

exec sh -c /usr/local/fsl/bin/Fdt_gui &

In the older version (1.5.18-1)
  the dialog I expect to see appears.

In the newer version (1.5.19) I see the following errors

: command not foundsr/local/fsl/bin/Fdt_gui: line 2:
': not a valid identifieri: line 4: export: `TCLTKSHELL
: command not foundFdt_gui: line 5:
/usr/local/fsl/bin/Fdt_gui: line 12: syntax error near unexpected token `('
'usr/local/fsl/bin/Fdt_gui: line 12: `set FSLDIR $env(FSLDIR)
[1]+  Exit 2                  exec sh -c /usr/local/fsl/bin/Fdt_gui

Any ideas would be appreciated, and please let me know if more information
is needed.


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list