Forum Discussion
Jul 05, 2014
correct syntax for boolean expressions
I experiencing errors with forming a simple boolean expression that would be valid in most "C like" languages ( if we added an equals sign = 😞
set var1 $var2 && !$var3
error: [wrong args][set ...
Kevin_Stewart
Jul 05, 2014Employee
Try this:
set var_1 [expr { [info exists var_2] || [info exists var_3] }]
By the way, Nitass is probably using the tclsh shell in the BIG-IP management GUI. You can also write pure TCL scripts with this:
!/usr/bin/tclsh
set var_2 true
set var_3 false
puts [info exists var_2]
puts [info exists var_3]
set var_1 [expr { [info exists var_2] || [info exists var_3] }]
puts $var_1
Then chmod the script:
chmod 755 balto.tcl
And run it like any other Bash script:
./balto.tcl
Great for troubleshooting TCL logic outside of an iRule.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects