Re: [PATCH 01/16] check-non-portable-shell: complain about "test" a/-o instead of &&/||

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> Given that these flags are considered obsolescent, thus may someday be
> dropped from some implementations, these seem a better fit for the
> "portability issues" section than the "coding style preferences"
> section. (I'd probably just drop those section titles, though.)
>
>> +       /\btest\s+-[a-z]\s+.*?\s+-a\s+/ and err '"test A && test B" preferred to "test A -a B"';
>> +       /\btest\s+-[a-z]\s+.*?\s+-o\s+/ and err '"test A || test B" preferred to "test A -o B"';
>
> These will only match the simplistic forms of `test -X blah` (where
> "-X" is some single letter option), but will miss expressions such as
> `test "$foo" = bar`. Crafting a regex to match more generally would be
> non-trivial, so this simpler match is a reasonable start. Okay.

Would it be a trivial improvement to do

    'test', followed by anything other than '&' or '|', and then
    followed by '-a' or '-o'

instead?



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux