On 3/14/18 4:02 PM, Eduardo Bustamante wrote: > On Tue, Mar 13, 2018 at 11:34 PM, Vladimir Likic <v.li...@gmail.com> 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 c...@case.edu http://tiswww.cwru.edu/~chet/