Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jul 1996 13:27:54 -0600 (MDT)
From:      Brandon Gillespie <brandon@tombstone.sunrem.com>
To:        Terry Lambert <terry@lambert.org>
Cc:        questions@FreeBSD.org
Subject:   Re: Bug in /bin/sh
Message-ID:  <Pine.BSF.3.91.960702132047.25181B-100000@tombstone.sunrem.com>
In-Reply-To: <199607021853.LAA08602@phaeton.artisoft.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, 2 Jul 1996, Terry Lambert wrote:
> >    test $1 = abc && {
[..]
> 
> The "&&" is odd.

Not really, it is standard bourne shell (from the man pages):

       Control operators: &  &&  (  )  ;  ;; | || <newline>

It acts as you suspect, so the following constructs would be equivalent 
(I've noticed that most of the ultrix boot scripts prefer the latter method):

    if [ -x "$file" ]; then
        if `$file`; then
            echo "oiy, it ran"
        fi
    fi

Or:

    [ -x "$file" ] && {
        $file && echo "oiy, it ran"
    }

-Brandon Gillespie



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.960702132047.25181B-100000>