Samstag, 8. Dezember 2007

bash: ELF: command not found

Problem:
 [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.