2022-02-14 03:22:51 +01:00
|
|
|
---
|
|
|
|
title: any?
|
|
|
|
layout: command
|
|
|
|
version: 0.59.0
|
|
|
|
---
|
2021-05-30 02:57:04 +02:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
Tests if any element of the input matches a predicate.
|
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
|
|
|
```> any? (predicate)```
|
2021-05-30 02:57:04 +02:00
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
- `predicate`: the predicate that must match
|
2021-05-30 02:57:04 +02:00
|
|
|
|
|
|
|
## Examples
|
2022-02-14 03:22:51 +01:00
|
|
|
|
|
|
|
Find if a service is not running
|
2021-05-30 02:57:04 +02:00
|
|
|
```shell
|
|
|
|
> echo [[status]; [UP] [DOWN] [UP]] | any? status == DOWN
|
2022-02-14 03:22:51 +01:00
|
|
|
```
|
2021-05-30 02:57:04 +02:00
|
|
|
|
2022-02-14 03:22:51 +01:00
|
|
|
Check if any of the values is odd
|
2021-05-30 02:57:04 +02:00
|
|
|
```shell
|
|
|
|
> echo [2 4 1 6 8] | any? ($it mod 2) == 1
|
2022-02-14 03:22:51 +01:00
|
|
|
```
|
2021-05-30 02:57:04 +02:00
|
|
|
|