\section contains contains - test if a word is present in a list
\subsection contains-synopsis Synopsis
contains [OPTIONS] KEY [VALUES...]
\subsection contains-description Description
\c contains tests whether the set \c VALUES contains the string
KEY
. If so, \c contains exits with status 0; if not, it exits
with status 1.
The following options are available:
- \c -i or \c --index print the word index
- \c -h or \c --help display this message
\subsection contains-example Example
for i in ~/bin /usr/local/bin if not contains \$i \$PATH set PATH \$PATH \$i end endThe above code tests if \c ~/bin and \c /usr/local/bin are in the path and adds them if not.