LOgical operator in ifeq

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

Question by:Thilak
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
LVL 21

Expert Comment

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

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

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

LVL 48

Expert Comment

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

Accepted Solution

tfewster earned 100 total points
ID: 11947535
Or if it's makefile syntax you mean:

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

Author Comment

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

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 ( 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