Alexander L Belikoff <[EMAIL PROTECTED]> writes:

> Package: lintian
> Version: 1.23.22
> Severity: normal

> Currently, lintian reports the shell construct 'if [[ ... ]]' as
> bashism. I am not sure this is correct, since all POSIX 1003.2 resources
> available to me declare '[[' and ']]' a standard conditional expression
> check in POSIX sh (don't confuse with older Bourne sh).

Nope.  [[ and ]] indicate built-in test evaluation, which is not a
required feature of a POSIX shell.  See:

    <http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html>

and observe that [[ and ]] are mentioned only in the following text:

    The following words may be recognized as reserved words on some
    implementations (when none of the characters are quoted), causing
    unspecified results:

        [[  ]]  function  select

So the behavior of [[ and ]] is unspecified in a pure POSIX shell.

If you want to use [[ or ]], you need to use #!/bin/bash or some
equivalent.

-- 
Russ Allbery ([EMAIL PROTECTED])               <http://www.eyrie.org/~eagle/>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to