?
Solved

LOgical operator in ifeq

Posted on 2004-08-31
4
Medium Priority
?
2,260 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 300 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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…
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.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

807 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