Some Win32 programs behave unexpectedly when you run them from within Interix. This usually occurs because the Win32 program uses the contents of an environment variable that has been set by Interix. Win32 programs expect variables to be in the Win32 format, but Interix variables use a POSIX format. This can cause Win32 programs to misinterpret the string values of variables.
Win32 programs use with the Interix PATH variable. This is possible because the value of PATH is automatically flipped to the Win32 format. The PATH variable is the only variable that flips from a POSIX format to a Win32 format. If a Win32 program is dependent on any variables other than PATH, the variables should be converted to a Win32 format before you run the program. An effective way of converting dependent environment variables is through the use of shell scripts.
For example, suppose that you wanted to run a Win32 version of the emacs program. The emacs program examines the contents of HOME and PATH (among other variables). HOME contains a path name; because you are running a Win32 program, you must convert the value of HOME to a Win32 format. Interix provides a command called posixpath2nt(1) to convert path names. Because you do not want this change to affect other Interix programs, you can do the conversion from within a shell script.
Below is a sample shell script for starting a Win32 program called emacs.exe, which is located in the /dev/fs/C/win32apps directory. Because the PATH variable is converted automatically, the script only converts HOME. When you develop your own scripts, you might need to convert more variables:
#!/bin/ksh
export HOME=$(posixpath2nt $HOME)
/dev/fs/C/win32apps/emacs.exe $*
You can use the #! notation at the top of a script to invoke a Win32 program that will interpret the script. For example, suppose that you had a bash script that you wanted to run using a Win32 port of the Bourne again shell (bash). If the bash shell were located at C:\winbin\bash.exe, you would type the following line at the top of your script:
#!/dev/fs/C/winbin/bash.exe
You must use an absolute path when calling a Win32 program with #! notation.