Subject: Re: /etc/rc with #!/bin/sh ?
To: Gandhi woulda smacked you <greywolf@starwolf.com>
From: David Maxwell <david@fundy.ca>
List: current-users
Date: 06/23/1999 10:56:41
On Wed, Jun 23, 1999 at 12:58:54AM -0700, Gandhi woulda smacked you wrote:
> On Wed, 23 Jun 1999, David Maxwell wrote:
> 
> # I guess the primary retort is that I sometimes find occassion to run
> # /etc/rc by hand from time to time. Also, anyone who knows what the file
> # command does, probably knows what type of file /etc/rc is.
> 
> Also, /sbin/init (I keep wanting to type /etc/init -- don'tcha just love
> legacy systems?) explicitly calls
> 	execv(_PATH_BSHELL, ("sh", "/etc/rc", autoboot? "autoboot": 0, 0));
> 
> [never mind the syntactical errors :-)]
> 
> That seems à propos.  I thought file(1)'s output was cute given that
> little string at the top of the file.

Sorry, I'm confused. I think you're saying that init calls rc using sh
no matter what's at the top, and asking if we should teach it to use
magic?

That's different from what I was droning on about anyway, but a valid
question. Anyone see usefulness in being about to run non-sh files
as /etc/rc? (Yes, I know you could just call it from sh...)

> Does our file(1) need a better algorithm, or would that be nuts given that
> there are quite a few shell scripts with enough filler in comments
> to force it to rely on the #! line?  (probably this is the case).

It might be interesting to allow file to read a second line, if the
first line is #!/bin/sh, and if the second line is a comment, use that
as part of the description...

#!/bin/sh
# Commands for system startup

$ file x
x: Bourne shell script text - Commands for system startup

That would give
1) The ability to file /etc/* |  grep Bourne | something
2) The ability to execute /etc/rc (provided you chmod +x)
3) The longer description for the sake of being prettier.

-- 
David Maxwell, david@vex.net|david@maxwell.net -->
(About an Amiga rendering landscapes) It's not thinking, it's being artistic!
					      - Jamie Woods