The following case condition will match if the returned FTP code is either 226 or 231.
The following case conditions will match if the returned FTP code is either 226 or 231, or between 250 and 299 inclusive. So 250 itself will match, as well as 251, 252 etc. up to 299
The following case conditions will match if the returned FTP code is in the 300s and the returned string contains the text “email address”.
The following case conditions will match if the returned FTP code is 500 or greater and the returned string contains the specified error message
If a case contains more than one condition they must be separated by and. The and operator specifies that all the listed conditions must be satisfied. So in the previous example, the FTP code must be between 500 and 599 AND the last reply must also contain the specified string. Both must be true. If either is false, the case will not match.
The not operator reverses the result of a function. We may for example want to make sure that the last response does not contain a certain string. For example:
There is no or operator. The same logic may be applied by using multiple case statements.
The following case condition will match if the send command timed out.
Case any is the catch all case, and if present should be the last case in the enclosing list. If it is followed by other case statements they will never be evaluated.
For example, the following case condition will always match.
If case statements overlap and two case statements would match the response, then the first one encountered will be executed.
Example:
If the case with the contains function appeared after the one without it, it would never get evaluated.
See Also |