3

Upon downloading Eagle 7.6, I wanted to add an alias to it. Even though ./eagle opens the application, bash eagle results cannot execute binary file error. I tried chmod +x eagle but it didn't help. Downloaded version is the 64 bit version.

The alias I created is as follows:

alias eagle='bash /home/metin/eagle-7.6.0/bin/eagle'

In case you wonder, here is the uname -a output:

Linux mettinoktay 4.4.0-34-generic #53-Ubuntu SMP Wed Jul 27 16:06:39 UTC
2016 x86_64 x86_64 x86_64 GNU/Linux

Thanks in advance.

6
  • 6
    Looks like eagle is a binary rather than a script, so running bash eagle doesn't make sense
    – edwinksl
    Aug 13, 2016 at 13:04
  • yup it doesnt make any sense as ./eagle is more comfortable than to type bash eagle
    – hellozee
    Aug 13, 2016 at 13:06
  • What do you mean by "add an alias" to it and why do you think bash eagle would help?
    – Random832
    Aug 13, 2016 at 13:07
  • By "add an alias", I mean that I'm trying to launch Eagle from terminal like I'm doing with dRonin and sage (check the .bashrc file screenshot). Aug 13, 2016 at 13:11
  • 2
    Remove bash from your alias
    – doug
    Aug 13, 2016 at 13:23

2 Answers 2

20

That's because eagle is a compiled executable, not a bash script. You are getting confused because you often see bash ./script suggested as a way of running the bash script saved in the text file script. For example:

$ cat foo.sh
echo "hello!"
$ bash ./foo.sh
hello!

So, the command bash ./foo.sh actually means "run bash and ask it to execute the commands found in the file foo.sh". However, binary executables are not shell scripts, they are not a list of simple commands and cannot be run that way. For example, if you try to run the ls binary using bash:

$ bash /bin/ls
/bin/ls: /bin/ls: cannot execute binary file

That's bash telling you it can't run this thing you told it to run because it is a binary file and not a text file containing a script.

So, to fix your problem, just remove the bash from your alias and, instead, point it to the actual location of the eagle executable:

alias eagle='/home/metin/eagle-7.6.0/bin/eagle'

Alternatively, add /home/metin/eagle-7.6.0/bin/ to your $PATH by adding this line to your ~/.bashrc:

PATH="$PATH:/home/metin/eagle-7.6.0/bin/"

That will let you execute any executable files in /home/metin/eagle-7.6.0/bin/ by name (by running eagle in this case) just like you do with any other executables such as bash itself, or ls.

1
  • Thank you very much for this comprehensive answer. It was like a tutorial. Aug 15, 2016 at 10:35
5

bash has to be removed from alias, that is:

alias eagle='/home/metin/eagle-7.6.0/bin/eagle'

@doug solved this issue on comments.

You must log in to answer this question.

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