Forum Discussion
Robert_47833
Altostratus
Jun 21, 2012how to write no or ! in switch
it was :
!({$var starts_with "/here"})
now I am trying to change it to switch
how to represent no or ! in switch?
hoolio
Cirrostratus
Jun 21, 2012Hi Robbie,
There isn't an option to negate, but you could use a default case to match anything that isn't matched by a prior case:
switch -glob $var {
"/here*" {
Matched here
}
"/there*" {
Matched there
}
default {
Didn't match here or there
}
}
Aaron
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