public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* What does " test ... || gcc ..." mean?
       [not found] ` <015701c17e6b$9844f120$7add18ac@amr.corp.intel.com>
@ 2001-12-06  7:57   ` Luker Lu
  2001-12-07  4:44     ` Andrea 'Fyre Wyzard' Bocci
  0 siblings, 1 reply; 2+ messages in thread
From: Luker Lu @ 2001-12-06  7:57 UTC (permalink / raw)
  To: gcc-help

Hi all,

I want to understand the source code of gcc so I am studying the build
process at first. In the process of "make bootstrap", the following command
appears:

test x"no" != xyes || \
  gcc -c -DHAVE_CONFIG_H -g -O2 -I. -I../../source/libiberty/../include
../../source/libiberty/argv.c -o pic/argv.o

I know what "test" and "gcc" are, but can't understand the whole command.
Could someone explain me what it does? What does this "||" between test and
gcc mean?
thanks in advance!

Luker Lu


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: What does " test ... || gcc ..." mean?
  2001-12-06  7:57   ` What does " test ... || gcc ..." mean? Luker Lu
@ 2001-12-07  4:44     ` Andrea 'Fyre Wyzard' Bocci
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea 'Fyre Wyzard' Bocci @ 2001-12-07  4:44 UTC (permalink / raw)
  To: Luker Lu, gcc-help

At 16.57 06/12/01 (GMT +0100), Luker Lu wrote:
>Hi all,
>
>I want to understand the source code of gcc so I am studying the build
>process at first. In the process of "make bootstrap", the following command
>appears:
>
>test x"no" != xyes || \
>   gcc -c -DHAVE_CONFIG_H -g -O2 -I. -I../../source/libiberty/../include
>../../source/libiberty/argv.c -o pic/argv.o
>
>I know what "test" and "gcc" are, but can't understand the whole command.
>Could someone explain me what it does? What does this "||" between test and
>gcc mean?
>thanks in advance!
>
>Luker Lu

Here is a fast explanation:

|| is the OR operator. It can also be used as a flow control operator, just 
like an if-then-else check.
That is, you can write a C style if-then-else block
if (condition)
   true-statement
else
   false-statement

as
test condition && true-statement || false-statement

However, unlike the C block, the "&& true-statement part" is not necessary, 
and can be skipped.

For more infos, have a look at sh or bahs man pages.

fwyzard


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-12-07 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.30.0112060810550.27655-100000@sol.galaxy.acm.jhu.edu>
     [not found] ` <015701c17e6b$9844f120$7add18ac@amr.corp.intel.com>
2001-12-06  7:57   ` What does " test ... || gcc ..." mean? Luker Lu
2001-12-07  4:44     ` Andrea 'Fyre Wyzard' Bocci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).