[Top][All Lists]

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

Re: Strange/incorrect behavior of a fake executable file

From: Chet Ramey
Subject: Re: Strange/incorrect behavior of a fake executable file
Date: Wed, 14 Mar 2018 16:06:37 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 3/14/18 4:02 PM, Eduardo Bustamante wrote:

> On Tue, Mar 13, 2018 at 11:34 PM, Vladimir Likic <address@hidden> wrote:
>> Sorry, meant why is bash executing the file without hash-bang '#!' ?
> You can see the answer here:
> http://git.savannah.gnu.org/cgit/bash.git/tree/execute_cmd.c?h=devel&id=bf5b8103d466fdbc3bfcdaa5e21a0d0c0dce7cba#n5608
> Oversimplified explanation:
> Bash performs the execve() system call on the executable file
> (`junk'). If the system returns ENOEXEC (i.e. not an executable), bash
> will then try to execute the file itself

(if it can determine the file is a text file).

This is a Posix requirement and historical shell behavior that long
predates the introduction of `#!'.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]