Perl problems

Colin Watson cjwatson at ubuntu.com
Fri May 13 14:33:04 UTC 2005


On Fri, May 13, 2005 at 05:08:04PM +0300, ZIYAD A. M. AL-BATLY wrote:
> On Fri, 2005-05-13 at 13:09 +0200, Alf-Ivar Holm wrote:
> > When sh¹ is started with a file name as argument, it tries to parse
> > the file as shell commands.  It does _not_ look for magic strings (!#
> > in this case) in the file, it just try to execute each line, where the
> > first line will be taken for a comment in sh.
> 
> True.  My fault.  That's is the responsibility of the loader (ld) not
> the shell.

Actually, ld.so only handles ELF executables (e.g. programs written in C
or C++). It's the responsibility of the execve() system call in the
kernel to deal with different binary formats, such as scripts beginning
with the magic "#!" characters. Have a look at fs/binfmt_script.c in the
kernel if you're interested.

Cheers,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]




More information about the ubuntu-users mailing list