aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src/contains.txt
blob: cc7463588a1809dcd42e0c0f369a54c54ffd2c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
\section contains contains - test if a word is present in a list

\subsection contains-synopsis Synopsis
<code>contains [OPTIONS] KEY [VALUES...]</code>

\subsection contains-description Description

\c contains tests whether the set \c VALUES contains the string
<code>KEY</code>. 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
<pre>
for i in ~/bin /usr/local/bin
	if not contains \$i \$PATH
		set PATH \$PATH \$i
	end
end
</pre>

The above code tests if \c ~/bin and \c /usr/local/bin are in the path and adds them if not.