Subject: Re: HELP : some newbie questions
To: Colin Wood <cwood@ichips.intel.com>
From: Henry B. Hotz <hotz@jpl.nasa.gov>
List: port-mac68k
Date: 02/13/1998 12:04:29
At 9:54 AM -0800 2/13/98, Colin Wood wrote:
>Bill Studenmund wrote:
>> On Mon, 9 Feb 1998, Fabiano Petrone wrote:
>> > 1. I've tried a simple pipe like "who | wc -l" and it works OK. I've saved
>> > this pipe in a file on /root/pub (call it "file") and I've chmoded it as
>> > executable with "chmod +x file".
>> > well, the problem is that when I call "file" from the prompt #, the system
>> > respond "file : not such command" : why?
>>
>> The top line of a shell script (your command) needs to be "#! /bin/sh".
>> Actually, it can be /bin/csh or /bin/tcsh or /bin/ksh as you wish (or even
>> #! /usr/local/bin/perl for a perl script). But you have to stick the
>> command which runs the script in the top line. You didn't do that, so the
>> system's confused.
>
>Actually, the error he's getting in this case is a result of not having
>/root/pub in his path.  I believe that Unix systems are defined to use
>/bin/sh as the interpreter for executables which they cannot figure out a
>magic number.  At least, it certainly works that way on my AIX machine
>here at work.

I thought both you guys knew this so maybe I'm wrong.

Executable files are handled by the current shell (usually csh for netbsd,
but usually sh for system scripts on other systems).  All standard, current
unix shells are programmed to look for a special format comment line at the
beginning of any script and if it points to a valid shell to switch to that
shell instead of processing the script themselves.

Since the test case he used is valid in any standard Unix shell he probably
doesn't have "." in his $PATH.  (Maybe he read that warning about not
having "." in the root path and did something about it!)

Signature failed Preliminary Design Review.
Feasibility of a new signature is currently being evaluated.
h.b.hotz@jpl.nasa.gov, or hbhotz@oxy.edu