2006-10-31 23:23:16 +08:00
|
|
|
\section contains contains - test if a word is present in a list
|
2006-01-27 01:34:37 +08:00
|
|
|
|
|
|
|
\subsection contains-synopsis Synopsis
|
|
|
|
<code>contains [OPTIONS] KEY [VALUES...]</code>
|
|
|
|
|
|
|
|
\subsection contains-description Description
|
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
\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.
|
2006-01-27 01:34:37 +08:00
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
The following options are available:
|
2006-01-27 01:34:37 +08:00
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
- \c -i or \c --index print the word index
|
|
|
|
- \c -h or \c --help display this message
|
2006-01-27 01:34:37 +08:00
|
|
|
|
|
|
|
\subsection contains-example Example
|
|
|
|
<pre>
|
|
|
|
for i in ~/bin /usr/local/bin
|
|
|
|
if not contains \$i \$PATH
|
2013-02-12 03:06:13 +08:00
|
|
|
set PATH \$PATH \$i
|
2006-01-27 01:34:37 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
</pre>
|
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
The above code tests if \c ~/bin and \c /usr/local/bin are in the path and adds them if not.
|