tags:

views:

168

answers:

3

Hi everyone,

I've playing around with linux and noticed that for some mysterious reason commands like '/bin/sh ' just will not work. Each time I'm trying to start a process it yields 'cannot execute binary file' error message.

m@sanctuary:~$ sh sed
/bin/sed: /bin/sed: cannot execute binary file

When I first launch sh and try to execute sed, it succeeds.

I'm starting to lose my wits. It would be just great, if somebody could help me.

Thank you.

A: 

sh is expecting a shell script as an argument, but you're giving it a binary file.

Brian Agnew
+1  A: 

You're trying to run sed as a shell script, sed is just an ordinary executable. You can just run it as

m@sanctuary:~$ sed
nos
+4  A: 

"sed" isn't a shell script, so you don't execute it with sh. Just type sed ...args... not sh sed ...args...

Paul Tomblin
Or if you really want to run it through `sh` for some reason you can use `sh -c sed`.
mark4o
@mark40, good point.
Paul Tomblin