bash errorif: Expression Syntax

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Sat Dec 10 16:48:50 UTC 2005


On Sat, 10 Dec 2005, Lennart Sorensen wrote:

> On Sat, Dec 10, 2005 at 10:23:05AM -0500, Chris F.A. Johnson wrote:
>>    That is not a bash script. On Solaris, /bin/sh is not bash, it is a
>>    Bourne shell. Bourne shells do not have the -e operand.
>>
>>    Either use [ -f 'file' ] or change the shebang to point to bash.
>
> [ is not always a shell builtin.

    It has been since the System II Bourne Shell of 1981. It is
    exceedingly unlikely that you will find a Bourne-type shell without
    test and [ as a builtin.


> The question is what does /bin/[ support.

    No, the question, almost certainly, is what does the shell builtin
    support.

    To verify that it is a builtin, at the prompt, type:

type [

> And the error message says nothing about the test syntax, just the
> if syntax.

    That is more evidence that it is a shell matter, not an external
    command problem.

-- 
    Chris F.A. Johnson                      <http://cfaj.freeshell.org>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list