Forum Discussion
jakk127_200290
Nimbostratus
May 01, 2015Trying to understand using square braces vs parenthesis in iRules
Hello,
I have an written the following iRule
when HTTP_REQUEST {
set user_agent [string tolower [HTTP::header User-Agent]]
if { not ($user_agent contains "windows nt 5.1")} {
vi...
jakk127_200290
Nimbostratus
May 01, 2015Hey. I looked at that article but it did not answer my questions. It gave a use case for parenthesis but did not explain how they were used
jakk127_200290
Nimbostratus
May 01, 2015Ok, well that follows what I was finding, which is why I am confused. I would think that a statement like
if { not [$user_agent contains "windows nt 5.1"]}
would mean that the command '$user_agent contains "windows nt 5.1"' would be executed first, which would result in a boolean, which would be negated by the not operator, which would then be passed to 'if'. However, I must not be understanding something correctly as that was causing the tcp reset, and only when I replaced the [ with ( did the irule operate correctly. I am even more confused because the first way, with the braces, compiled and did not give me any errors
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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