Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Using BF_AGENT_PLATFORM in a conditional step

I want to have a step that executes the Command commands if the agent is on unix and the Else Command part if the agent is running on windows. I tried to put this condition but it didn't work:
true(BF_AGENT_PLATFORM==aix 3 5)
true(BF_AGENT_PLATFORM=="aix 3 5")


Any idea how can I build the conditional expression properly?


Thanks!

0 votes



5 answers

Permanent link
I want to have a step that executes the Command commands if the agent is on unix and the Else Command part if the agent is running on windows. I tried to put this condition but it didn't work:
true(BF_AGENT_PLATFORM==aix 3 5)
true(BF_AGENT_PLATFORM=="aix 3 5")


Any idea how can I build the conditional expression properly?


Thanks!


Hi epzee,

I use the following condition frequently in my libraries.

${BF_AGENT_PLATFORM} contains Windows


If you don't like using the 'contains', then I would suggest using the comparison operator of 'eq' instead of '==' since you're comparing a string instead of number.

Brent Ulbricht
Developer/Lead - RTC Build

0 votes


Permanent link
Great, that's exactly what I was looking for! Is there any doc with a list of all possible operators? I only found the string operators in the online help, but no example of the contains condition you wrote.

Thanks!

0 votes


Permanent link
Great, that's exactly what I was looking for! Is there any doc with a list of all possible operators? I only found the string operators in the online help, but no example of the contains condition you wrote.

Thanks!


Hi,

In the documentation at 'Working with steps' -> 'Controlling execution flow' -> 'Condition functions', there are some examples of the various functions that can be used in the condition field.

Brent Ulbricht
Developer/Lead - RTC Build

0 votes


Permanent link
In article <imvckf>,
epzee <amazza> wrote:
I want to have a step that executes the Command commands if the agent
is on unix and the Else Command part if the agent is running on
windows.

It's also possible to have a CMD script and a Bourne-like shell script
in the same file. It depends on the fact that "goto" is a command in
CMD but not in a Bourne-like shell. So when the script is run by CMD,
the goto executes; when run by bash or sh or the like, it falls thru
to the next statement (with an error exit code and an error message on
stderr, file descriptor 2).

On my system, where the UNIXy shell is Cygwin's bash running on
Windows:

GOTO :CMD_COMMANDS 2>NUL:
# The next is a Cygwin extension to cause the shell to
# ignore the carriage returns.
set -o igncr # must keep a comment here.

# bash commands here.
exit

:CMD_COMMANDS

REM CMD commands here
exit

For your setup, where the agent is on real Linux or UNIX, you'd remove
the "set -o igncr" and instead "rm NUL:".

--
Tim McDaniel, tmcd@panix.com

0 votes


Permanent link
In article <in7i3l>,
Tim McDaniel <tmcd> wrote:
On my system, where the UNIXy shell is Cygwin's bash running on
Windows:

....
# The next is a Cygwin extension to cause the shell to
# ignore the carriage returns.
set -o igncr # must keep a comment here.

Carriage returns appear to be an artifact of the Opera Web browser
only. When I run Opera on Windows and save a step, it appears to send
in the text with lines ending in carriage return-linefeed. From
Firefox or IE (!), the lines in a step only end in newline.

It's bad when that happens for the .drill command, because it refuses
to ignore the trailing carriage return and throws a syntax error and
usage message, and there's no workaround other than switching
browsers. (RBF supports only IE and Firefox.)

--
Tim McDaniel, tmcd@panix.com

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Mar 30 '11, 9:49 a.m.

Question was seen: 5,628 times

Last updated: Mar 30 '11, 9:49 a.m.

Confirmation Cancel Confirm