Help with #!/usr/bin/perl

Mike Crawford mdcrawford at
Sun Jun 17 00:07:36 UTC 2018

My understanding is that the kernel supports scripts of any flavor by
exec'ing whatever follows the shebang.  That is, you can fork a child
process then that process can exec a script just as it would a native
executable written in C.

Every executable starts with Magic Number that informs the kernel what
kind of code it is.  One some systems, the Java bytecodes' magic
number enables on to run Java programs the same way one can run C

The "#!" is the Magic Number for all shell scripts.

There really should have been some way to make this more flexible, as
/usr/bin/env was added much later in the history of *NIX.

But env is what we have.

Mike Crawford
Portland Custom Software Development
mdcrawford at

More information about the macports-users mailing list