[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Handling multiple conditions in if statements

From: Adam Mercer
Subject: Handling multiple conditions in if statements
Date: Thu, 7 Apr 2011 11:52:52 -0500


In one of my macros I need to do one thing on linux platforms and
another on others, in the macro I have the followings:

  if test "x$build_os" = "xlinux"; then
    # case for linux
    # other platforms

I recently received a bug report that this wasn't working as the users
system had $build_os defined as 'linux-gnu', whereas on others it was
just 'linux'. I then tried to change the if statement to:

  if test "x$build_os" = "xlinux" -o test "x$build_os" = "xlinux-gnu"; then

but that didn't work, in fact any of the usual ways I would do an OR
in shell script didn't work.

How can I have an if statement with multiple conditions? Or is there a
better way to accomplish this?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]