Forum Discussion

gerald_wegener_'s avatar
gerald_wegener_
Icon for Nimbostratus rankNimbostratus
Aug 28, 2006

Possible to use SWITCH with variable

 

Is it possible to use switch to do the following using variables?

 

I've been trying for a while but can't get it to work using SWITCH.

 

 

-------

 

X = some random number say 50

 

 

A =10

 

B =4

 

C =6

 

----------

 

 

 

if { $X > $A } {

 

pool pool01

 

}

 

if { $X <= $B } {

 

pool pool02

 

}

 

 

if { (($X > $B) and ($X <= $A)) } {

 

pool pool3

 

}

 

 

 

Thank you for your help.

 

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    I'm not sure "switch" is the right command for the job...

     

     

    "switch" is useful when you want to react to equality with known values or patterns, but since you are instead evaluating inequalities, I think what you have is more appropriate.

     

     

    HTH

     

    /deb