Solved

LOgical operator in ifeq

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

-thanks
0
Comment
Question by:Thilak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 76
notReplace  challenge 53 152
EvenOdd challenge 10 159
matchUp  challenge 9 131
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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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