Samstag, 8. Dezember 2007

bash: ELF: command not found

 [methos@methos ../mjc/svn/trunk]$ . env 
bash: ELF: command not found

So source'ing a correct file (even with the #!/bin/sh shebang entry on top) doesn't work. Note the space between the dot and the env filename - thats equivalent to calling the file as argument to the source command.

Solution: explicitly specifying the current file to be in the current directory:
 [methos@methos ../mjc/svn/trunk]$ . ./env 
[methos@methos ../mjc/svn/trunk]$

Real solution: Thou should know, that env is a programs name and thus name lookup rules resolve the env to the env binary file. Therefrom comes the ELF - the unix executable format - string in the error, as bash tries to "execute" the binary, but in a line-wise bash manner.

Thus: Don't use command names as file names or make sure to use the ./ prefix to securely refer to the current directory.

1 Kommentar:

elvis hat gesagt…

Thanks a bunch for this one, I would never have figured it out. Actually I tried making a filed named "test" with just "echo hello" in it, but of course "test" is also a command! Really I would never have figured it out! Thanks! :)