On 04/01/2010 11:07 AM, Jim Meyering wrote:
> Eric Blake wrote:
>> On 04/01/2010 04:17 AM, Jim Meyering wrote:
>>>
>>> +sc_prohibit_echo_minus_en:
>>> +   @re='\<echo -[en]'                                              \
>>> +   msg='do not use echo ''-e or echo ''-n; use printf instead'     \
>>> +     $(_prohibit_regexp)
>>
>> This would be nice in gnulib, alongside the rule against test -a.
> 
> Yes, it's on my list.

While we're at it, can $re be broadened to catch other unportable usage
patterns?  Pretty much _any_ leading - is unportable, as is any embedded
\, and since $ or ` for command substitution can hide \, they are worth
checking as well.  In other words, I'm thinking:

@re='\<echo (-|.*[$`\])'

with a corresponding change in $msg.

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to