Bash Cheatsheet
Conditional from function is_field() { local field for field in $FIELDS; do if [[ "$field" == "$1" ]]; then return 0 fi done return 1 } if is_field; then ... fi List TRAILERS=() TRAILERS+=( "--trailer" "Co-authored-by: $(get_author_name) <$(get_author_email)>") git commit "$@" "${TRAILERS[@]}" Loop over multiline variable LINES=$(cat <<EOF line1 line2 EOF ) while IFS='\n' read line; do ... done <<< "$LINES"