[ClusterLabs] ocf scripts shell and local variables
Dejan Muhamedagic
dejanmm at fastmail.fm
Wed Aug 31 08:59:00 UTC 2016
On Tue, Aug 30, 2016 at 12:32:36PM -0500, Dimitri Maziuk wrote:
> On 08/30/2016 11:15 AM, Dejan Muhamedagic wrote:
>
> > I suppose that it is explained in enough detail here:
> >
> > https://en.wikipedia.org/wiki/Shebang_(Unix)
>
> I expect you're being deliberately obtuse.
Not sure why do you think that when I offer a perfectly good
document on how "#!" line is interpreted.
> It does not explain which program loader interprets line 1 of findif.sh:
> "#!/bin/sh" when it is invoked from line 69 of IPAddr2 RA:
>
> . ${OCF_FUNCTIONS_DIR}/findif.sh
When a file is sourced, the "#!" line has no special meaning
(apart from documenting purposes).
> https://github.com/ClusterLabs/resource-agents/blob/master/heartbeat/IPaddr2
> https://github.com/ClusterLabs/resource-agents/blob/master/heartbeat/findif.sh
>
> Similarly, I have not read the code so I don't know who invokes IPArrd2
> and how exactly they do it. If you tell me it makes the kernel look at
> the magic number and spawn whatever shell's specified there, I believe you.
I haven't read the code either, but it must be some of the
exec(2) system calls.
> > As already mentioned elsewhere in the thread, local is supported
> > in most shell implementations and without it we otherwise
> > wouldn't to be able to maintain software. Not sure where local
> > originates, but wouldn't bet that it's bash.
>
> Well 2 out of 3 is "most", can't argue with that.
There are certainly more than 3.
Thanks,
Dejan
More information about the Users
mailing list