On 3/24/18 3:31 PM, L A Walsh wrote:

> bash sleep 1
> 
> I get:
> 
> /usr/bin/sleep: /usr/bin/sleep: cannot execute binary file
> 
> ???
> Isn't it bash that cannot execute the binary file because
> it expected a script?

Think about what happens when you run a command like that. Bash sees
that it has an argument, which it assumes to be a script. It sets the
positional parameters and $0 accordingly. Posix and historical behavior
say that $0 gets set from the name of the script.

Then the shell attempts to open the file and read it. It discovers
the file is not a text file, and refuses to execute it, prefixing the
error message with $0 as it usually does.


-- 
``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/

Reply via email to