Is In

isin
Arguments:
  • $1 - Value to search for

  • [$2…] - Values of array to search over

Output:

Exit code is 0 for found, 1 for not found

Bash CLI version of isin

See also

isin

isin
Arguments:
  • $1 - Value to search for

  • [$2…] - Values of array to search over

Output:

Returns 0 for found, 1 for not found

Checks if a value is in an array

Example

isin 33 11 22 33 44
# $? is 0
isin 0 2 2 2
# $? is 1