Solved

LOgical operator in ifeq

Posted on 2004-08-31
4
2,088 Views
Last Modified: 2013-12-26
How to use a Logical operators (AND,OR) in 'ifeq' statement?

-thanks
0
Comment
Question by:Thilak
  • 2
4 Comments
 
LVL 21

Expert Comment

by:tfewster
ID: 11942638
if ( test -f a && test -f b )
then
 echo "Both files exist"
fi

if ( test -f a || test -f z )
then
  echo "One of the files exists"
fi

Or, for numerics:

if [[ 1 -eq 1 && 2 -eq 2 ]]^Jthen^Jecho "Both the same"^Jfi


if [[ 1 -eq 1 || 2 -eq 3 ]]^Jthen^Jecho "One matches"^Jfi

0
 
LVL 48

Expert Comment

by:Tintin
ID: 11947354
Do you mean in C source?
0
 
LVL 21

Accepted Solution

by:
tfewster earned 100 total points
ID: 11947535
Or if it's makefile syntax you mean:
http://www.gnu.org/software/make/manual/html_mono/make.html#SEC79

I can't see any examples there of logical operators to evaluate multiple conditions, so I guess you'd need multiple ifdef tests
0
 

Author Comment

by:Thilak
ID: 11949163
I need it for Makefile 'ifeq' statement.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question