dhcpcd-discuss

Re: dhcpcd runhooks- which shell?

Roger Shepherd

Tue Aug 30 09:46:50 2016

Roy

Thanks for the fast response and for the suggestions on how to use bash if I really need to. [I did (eventually) guess
that the reason for using sh was compatibility].

In fact, the problem I had was that sh doesn’t accept <<< as redirection whereas bash does. And as it’s decades (literally)
since I’d done any shell scripting all debugging takes a long time. But it’s a learning experience.

Roger

> On 30 Aug 2016, at 10:06, Roy Marples <roy@xxxxxxxxxxxx> wrote:
> 
> Hi Roger
> 
> On 28/08/2016 19:55, Roger Shepherd wrote:
>> I running dhcpcd 6.71. on a Raspberry Pi under Rasbian Jessie.
>> 
>> It seems that the runhooks run under sh rather than bash. Is this how
>> it has to be, or is there an easy way of causing them to run under
>> bash?
> 
> dhcpcd uses sh because every OS ships with one which should adhere to a
> strict set of rules called POSIX.
> 
> Is there a reason why you need bash rather than sh? There is nothing
> that can be done in bash that cannot (albeit with some creative
> thinking) be done in sh.
> 
> If you really need bash simply change the first like of
> /libexec/dhcpcd-run-hooks (or where-ever your OS installed it to to
> #!/bin/bash).
> 
> Another alternative is to write your script in bash and call it via
> dhcpcd.exit-hook or dhcpcd.enter-hook, both of which are decribed in
> dhcpcd-run-hooks(8).
> 
> Roy

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


Follow-Ups:
Re: dhcpcd runhooks- which shell?Roy Marples
References:
dhcpcd runhooks- which shell?Roger Shepherd
Re: dhcpcd runhooks- which shell?Roy Marples
Archive administrator: postmaster@marples.name