Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Command execution



On 11/15/21, aismtnt@xxxxxxxxxxxx <aismtnt@xxxxxxxxxxxx> wrote:
>
> Documentation:
> https://zsh.sourceforge.io/Doc/Release/Command-Execution.html
>
> There is a statement in docs:
>
> 'If execution fails because the file is not in executable format,and the
> file is not a directory, it is assumed to be a shellscript. /bin/sh is
> spawned to execute it.'
>
> I wonder if it's true or maybe I'm missing something.
>
> My understanding is that if I create a file with shell commands but won't
> change its mode to executable, it will still be executed, because it is
> assumed to be a shell script.
>
> But it does not.

"executable format" refers to the contents of the file, eg will the
kernel exec()ute this, and "executable mode" refers to the mode of the
file, they are not the same thing. The quoted statement only applies
if execution failed because of the file contents not being a valid
executable format, but in your case the execution failed because of
missing permissions (earlier check), so the statement does not apply.

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author