Not evaluating OS as expected

(imported topic written by RichB91)

My If/Then statement for setting parameters for paths that vary by OS isn’t evaluating as expected. On a Windows (WinXP) test system, the parameters for the Unix portion of my If/Then statement are getting assigned instead of the Windows values.

Any idea what I’m missing?

In the QnA tab of relevance Debugger, I get this result:

q: name of operating system as string as lowercase contains “win”

A: True

T: 0.162 ms

In the Action tab, using the following:

// Set Path and File parametes for Windows and Unix

if {name of operating system as string as lowercase contains “win”} Then

Parameter “DirScripts” = “c:\Company_Tools\BigFix\Scripts”

Parameter “DirArchives” = “c:\Company_Tools\BigFix\Archives”

Parameter “DirLogs” = “c:\Company_Tools\BigFix\Logs”

else

Parameter “DirScripts” = “/opt/apps/tools/bigfix/scripts/”

Parameter “DirArchives” = “/var/opt/apps/tools/bigfix/archives/”

Parameter “DirLogs” = “/var/opt/apps/tools/bigfix/logs/”

endif

The output to the Client Log tab is:

STATUS: Running action…

Command succeeded parameter “DirScripts” = “/opt/apps/tools/bigfix/scripts/”

Command succeeded parameter “DirArchives” = “/var/opt/apps/tools/bigfix/archives/”

Command succeeded parameter “DirLogs” = “/var/opt/apps/tools/bigfix/logs/”

  • Result —

Evaluation completed successfully!

(imported comment written by RichB91)

With further experimentation, I found the problem.

I’m used to If/Then statements.

BigFix uses If without the When.

If {X}

Action 1

Else

Action 2

EndIf

(imported comment written by NoahSalzman)

Well, it’s not just BigFix, the “then” is silent in: C, C++, C#, Objective-C, Java, JavaScript, Lisp, Perl, PHP, Python, Ruby

Of course, that doesn’t make it any less annoying if you are someone who is used to bash shell scripting. :slight_smile: