Find In

findin
Arguments:
  • $1 - Value to search for

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

Output:

stdout - -1 for not found, else the index of the first match

Bash CLI version of findin

See also

findin

findin
Arguments:
  • $1 - Value to search for

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

Output:

stdout - -1 for not found, else the index of the first match

Finds the index of the first match in an array

Example

findin 33 11 22 33 44
# 2
findin 0 2 2 2
# -1