# Linux Shell Scripting - bash: ELF command not found



## shady_inc (Sep 12, 2008)

Hello.!
I have a executable tbc stored at $HOME/abc/xyz/tbc.Now, if I try running the executable with ". $HOME/abc/xyz/tbc" or "source $HOME/abc/xyz/tbc", it gives a message:
bash: ELF : command not found
But if I first cd to $HOME/abc/xyz and then run"./tbc", it works just fine.
What's the issue here.?
Thanks.!


----------



## mehulved (Sep 12, 2008)

Works fine for me. Can you show us your script?


----------



## shady_inc (Sep 12, 2008)

The executable I am talking about is the Befunge Compiler.It can be found here.I compiled the C source file and am trying to the executable when it comes up with the error.


----------



## Sykora (Sep 12, 2008)

When you use source, you're asking the shell to interpret the file. When you try to source a binary executable, it'll try to interpret it and fail. Use source only on scripts which the shell can understand.


----------



## shady_inc (Sep 12, 2008)

Sykora said:


> When you use source, you're asking the shell to interpret the file. When you try to source a binary executable, it'll try to interpret it and fail. Use source only on scripts which the shell can understand.


But that doesn't explain why the executable works when I cd to it's directory and then source it.


----------



## mehulved (Sep 13, 2008)

shady_inc said:


> ". $HOME/abc/xyz/tbc"


This is definitely wrong, no wonder it's giving you a problem. It can be $HOME/abc/xyz/tbc but not this.


shady_inc said:


> "source $HOME/abc/xyz/tbc", it gives a message:
> bash: ELF : command not found


Here's the description of source from the man pages


> source - Evaluate a file or resource as a Tcl script


definitely not what you want.


shady_inc said:


> But if I first cd to $HOME/abc/xyz and then run"./tbc", it works just fine.
> What's the issue here.?
> Thanks.!


Cos you're running the executable file itself out here.


----------

