[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SRFI 22

 | Date: Sat, 8 Nov 2003 07:57:37 -0500
 | From: Marc Feeley <feeley@xxxxxxxxxxxxxxxx>
 | > SRFI-22:
 | > 
 | >   It seems that Windows script syntax is fundamentally
 | >   incompatible with Unix script syntax, so it is impossible to
 | >   write a single file which will run as a script on both Unix and
 | >   Windows. (See also Marc Feeley's message on the subject.)
 | > 
 | > It is possible with the use a small MS-DOS script named "#!.bat".
 | > http://www.swiss.ai.mit.edu/~jaffer/scm_3.html#SEC37

The programs (#!.bat and !#.exe) are available from

 | I've considered something like this but the problem that I
 | encountered was that the batch file which calls #!.bat on the first
 | line will echo (at least) that first line when it is run.

The first line only will be echoed.  Echoing can be suppressed by
prepending @ to the first line (@#!...) of the script.

 | To me this is not an acceptable solution.  I want a script to be
 | indistinguishable from a binary executable from the user's point of
 | view.

A script must have an extension other than .EXE, so it is
distinguishable even before it is run.  Older versions of Windows will
choke on unix line-endings.  If your expectations for script
compatibility allow for automated installation, then all problems can
be solved: @ is inserted as the first character, line-endings are
windowized, and the resulting script is written to the

 | I'm not a Windows expert so maybe your #!.bat does this properly.
 | Can you confirm?

Scripts can be written which run in both Unix and Windows using
#!.bat.  The first line of the script will be echoed unless it is
prepended with @.