[ClusterLabs] Antw: Re: Need bash instead of /bin/sh

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Thu Sep 24 06:10:46 UTC 2015


>>> Jan Pokorný <jpokorny at redhat.com> schrieb am 23.09.2015 um 22:30 in
Nachricht
<20150923203005.GA10123 at redhat.com>:
> On 23/09/15 15:38 +0200, Ulrich Windl wrote:
>>>>> Vladislav Bogdanov <bubble at hoster-ok.com> schrieb am 23.09.2015 um
15:24
>>> 23.09.2015 15:42, dan wrote:
>>>> Did a small test:
>>>> ---------------test.sh----------------
>>>> controld_start() {
>>>>      local addr_list=$(echo AF_INET 10.1.1.1 AF_INET 10.1.1.2)
>>> yep, that is a bashism.
>>> 
>>> posix shell denies assignment of local variables in the declaration.
> 
> This is supported by checkbashisms's finding (v2.15.5):
> 
> $ checkbashisms -p test.sh 
>> script test.sh does not appear to have a #! interpreter line;
>> you may get strange results
>> possible bashism in test.sh line 2 (local foo=bar):
>>     local addr_list=$(echo AF_INET 10.1.1.1 AF_INET 10.1.1.2)
> 
>> In times of BASH it's hard to get POSIX shell documentation.
> 
> Oh, really?
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html 

Thanks for the pointer! What I wanted to says is: When reading the BASH
documentation, it's increasingly hard to find out what is POSIX and what iS
BASHism.

> 
> It doesn't seem to recognize the concept of "local" declaration,
> though.
> 
>> The last we had was from HP-UX. But the problem seems to be more $()
>> than assignment it seems.
> 
> That documentation recognizes $() form.
> 
> -- 
> Jan (Poki)







More information about the Users mailing list