1

I want to run unity3d on my bash in order to put alias and .desktop entries. However, this proves to be more difficult.

The title error appears I try the command:

bash path/to/program 

Searching through the site it seems to be a compatibility problem. So when I try the file command the output is:

program: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=8020f3d60eff5b41c53e6b60a9e2d43802e28f93, not stripped

while my system is x86_64.

However when I go directly to the folder and run the program as

./program

the program runs normally.

I don't see how that can be a compatibility problem with my system when I can run the program with ./program but not with bash program

As a note, I am using zsh and I am not sure if that interferes in any way.

2
  • That's completely normal - bash is an interpreter, it executes shell scripts not binary executable files Jan 21, 2017 at 18:08
  • Bash reads plain text files with shell commands. Binary files aren't plain text. See muru's answer for proper use Jan 21, 2017 at 19:02

2 Answers 2

6

When you do bash some/file, bash reads that file, parses its contents according to bash's syntax rules and executes the resulting commands. Valid files are usually called "scripts", and their contents are much like what you actually type out in a shell. Compiled programs contain machine instructions. You use zsh - do you expect it to understand machine instructions? Zsh doesn't, and neither does bash.

If you want to use bash to execute a command, use the -c option:

bash -c '/some/command'

But there's not much point to doing so when the command itself is executable. If you can run it using /some/command, then use it directly.

1

At the command prompt in bash, zsh or other shell, you can write /path/to/program or cd /path/to; ./program both should give same result .. that the program runs.

File tells you that it's a binary executable program .. as opposed to a script in some language thet needs to be interpreted by some shell or other program.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .