Solved

LOgical operator in ifeq

Posted on 2004-08-31
4
2,033 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 20

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 20

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now