3

While I am able to execute binaries, when the terminal is open, if I type:

/bin/bash make

or

/bin/sh ls

I get: /usr/bin/make: /usr/bin/make: cannot execute binary file

Why is that? I am on Mavericks, and I have installed the latest Command Line Tools of XCode.

I want to use bash to execute make, because I want to setup external build tools for AppCode.

Cheers

8

When you call /bin/bash with only one argument, you can only run scripts. Not binaries. This has nothing to do with the tools you installed, it's just the behavior described in the man page.

/bin/bash -c ls should do what you want.

  • Thanks a lot! I have another question. When I execute /bin/bash the PATH env. var is not set. Are there any CLA for bash to run my .profile file? – Paschalis May 28 '14 at 1:18
  • @Paschalis The -l argument will make the shell a "login" shell, meaning it will execute your .profile/.bash_profile/etc. – 0942v8653 May 28 '14 at 1:25
  • Hmm, it didn't worked, but I found a workaround for my case! THANKS! – Paschalis May 28 '14 at 1:33
  • 1
    @Paschalis It works for me, but as a more general way, the --init-file option will allow you to specify a file to run at startup. – 0942v8653 May 28 '14 at 1:41
  • Note that if you have Terminal open, you are already running bash (unless you changed your default shell). Thus, all you have to do to have bash run ls is type the command ls. When you type /bin/bash -c ls, that tells bash to run another instance of bash, and have that instance run ls. I can't think of a reason to bother with that second bash instance... – Gordon Davisson May 28 '14 at 2:32

You must log in to answer this question.

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