%% Alexander Kotelnikov <[EMAIL PROTECTED]> writes:

  Paul> It's a good idea, but not necessary.  If there is no known magic value
  Paul> at the beginning of the file then the kernel just gives it to /bin/sh.

  ak> kernel? shell I think.

I don't know what you mean.  It's the kernel, typically, that interprets
magic numbers (the first two bytes of a file) and invokes interpreters
if #! is given.  This happens when you run one of the exec*(2) system
calls.  I suppose sometimes it might be implemented in a userspace
wrapper for the exec() system call, but typically it's the kernel.

  ak>  Always great to get perl script passed to sh.

Yes, in this case it _is_ great.

The script is a perl script with some sh code at the top to invoke Perl,
without specifying where it is (so the shell uses $PATH to locate it).
If the script is running in Perl, that code is ignored (through some
tricky hacks).  If the script is running in sh, the code is invoked to
start Perl.

This is a _very_ common idiom for all kinds of interpreters which don't
have predefined locations (Perl, TCL, Python, etc. etc.)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]> HASMAT--HA Software Mthds & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to