Can't execute a script

N.J. Thomas njt at
Fri Sep 9 17:42:33 PDT 2005

* bob self <bobself at> [2005-09-09 18:41:35 -0400]:
> 0000000: 2321 2f62 696e 2f73 680d 0a65 6368 6f20  #!/bin/sh..echo
> 0000010: 2270 696e 6769 6e67 2e2e 2e2e 220d 0a    "pinging...."..

Yup, that's your problem. This file is a DOS text file, so its end of
line is a <cr><nl> (0x0d 0x0a) instead  of just <nl> (0x0a).

Normally, that doesn't matter because most Unix utilities are
multi-eol-format aware, but you can't have it in the shebang line
because the OS interprets the extra carriage as part of the command, so
it is looking for /bin/sh^M, which doesn't exist.

Use a utility like dos2unix or some a decent text editor to convert this
to a Unix file format and you'll be good to go.


N.J. Thomas
njt at
Etiamsi occiderit me, in ipso sperabo

More information about the freebsd-questions mailing list