Linux Shell Scripting - bash: ELF command not found

Status
Not open for further replies.

shady_inc

Pee into the Wind...
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.!
 
OP
shady_inc

shady_inc

Pee into the Wind...
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

I see right through you.
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.
 
OP
shady_inc

shady_inc

Pee into the Wind...
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

18 Till I Die............
". $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.
"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.
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.
 
Status
Not open for further replies.
Top Bottom