Can't execute a script

N.J. Thomas njt at ayvali.org
Fri Sep 9 14:23:08 PDT 2005


* bob self <bobself at charter.net> [2005-09-09 15:01:25 -0400]:
> #!/bin/sh
> echo "pinging...."
> #end of scripttest
> 
> If I run "which scripttest", I get /root/bin/scripttest
> 
> But if I try to run this test script I get "scripttest: Command not found."
> 
> Why is that happening?

I've seen something like this happen when there is a non-printing
character on the shebang line (like a CTRL-G or similar). So instead of
running /bin/sh, your shell tries to run "/bin/sh^G" -- which obviously
doesn't exist.

Can you run "xxd /root/bin/scripttest" and show us the output? If you
don't have xxd on your system (it usually is packaged with Vim) you can
try "od -x /root/bin/scripttest".

xxd/od will show right away if there is anything funky on the shebang
line that shouldn't be there.

thanks,
Thomas

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


More information about the freebsd-questions mailing list