Skip to content

Instantly share code, notes, and snippets.

@nibalizer
Created May 8, 2012 10:35
Show Gist options
  • Save nibalizer/2634139 to your computer and use it in GitHub Desktop.
Save nibalizer/2634139 to your computer and use it in GitHub Desktop.
bash thing i found
##
# usage : in_array( $needle, $haystack )
# return : 0 - found
# 1 - not found
##
in_array() {
local needle=$1; shift
local item
for item in "$@"; do
[[ $item = $needle ]] && return 0 # Found
done
return 1 # Not Found
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment