Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Sep 2005 17:23:05 -0400
From:      "N.J. Thomas" <njt@ayvali.org>
To:        bob self <bobself@charter.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Can't execute a script
Message-ID:  <20050909212305.GC15735@ayvali.org>
In-Reply-To: <4321DC05.3050509@charter.net>
References:  <4321DC05.3050509@charter.net>

next in thread | previous in thread | raw e-mail | index | archive | help
* bob self <bobself@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@ayvali.org
Etiamsi occiderit me, in ipso sperabo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050909212305.GC15735>