Solved

LOgical operator in ifeq

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ORA-01403: no data found 43 98
ShiftLeft challenge 21 80
child constructor and parent constructor, overriding and overloading 6 83
Work with App store 7 51
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…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

815 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

8 Experts available now in Live!

Get 1:1 Help Now