help-bash
[Top][All Lists]
Advanced

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

[Help-bash] Executing an empty file. Bug or feature?


From: Ricardo Ribalda Delgado
Subject: [Help-bash] Executing an empty file. Bug or feature?
Date: Fri, 27 Mar 2015 11:59:48 +0100

Hello

A friend of mine has found this behaviour from bash that is a bit weird.


If you try to execute an empty file, it returns 0.

address@hidden:/tmp$ touch empty
address@hidden:/tmp$ chmod a+x empty
address@hidden:/tmp$ ./empty
address@hidden:/tmp$ echo $?
0

execve() on the other hands returns -1 ENOEXEC

address@hidden:/tmp$ strace -f ./empty
execve("./empty", ["./empty"], [/* 40 vars */]) = -1 ENOEXEC (Exec format error)
write(2, "strace: exec: Exec format error\n", 32strace: exec: Exec format error
) = 32
exit_group(1)                           = ?
+++ exited with 1 +++


Is this behaviour expected or is a bug ?


Regards!



-- 
Ricardo Ribalda



reply via email to

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