Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jun 2001 10:54:38 +0400
From:      Dmitriy Kyrhlarov <dimma@electromir.ru>
To:        Dave Tweten <tweten@nas.nasa.gov>
Cc:        Pete Fritchman <petef@databits.net>, freebsd-doc@FreeBSD.ORG
Subject:   Re: Fw: Re: Bourne Shell Syntax Wierdness
Message-ID:  <3B3C262E.B44B479D@electromir.ru>
References:  <8389E4C083FF6622C3256A7A0019EB8A.0019EBE9C3256A7A@electromir.ru>

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

1. sorry for my english. :-)

Dave Tweten wrote:
> 
> petef@databits.net said:
> >you first take 'true || true' -- you end up with true.
> 
> According to the man page, "||" is NOT "or".  Instead it is an operator
> that
> causes the command to its right to be executed only if the simple command
> to
> its left fails.  Therefore, 'true || true' means "continue without
> executing
> the rightmost "true".

I can't understand where is a problem?

true || true && echo "oops!"
prints "oops!"

true || echo "not oops!" && echo "oops!"
prints "oops!"

i.e.

true || command 1 && command 2
equivalent:
true && command 2

and it's a right...

>         command1 [ || command2 ] ...
>         command1 [ && command2 ] ...
> Curiously, POSIX says nothing about a list containing both operators.

pay attantion:
"||" and "&&" -- part of command2,

therefore
true [ || command1 ] [ && command2 ]

we can write:
true [ && command2 ]

By.
Dmitriy

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B3C262E.B44B479D>