2006-10-31 15:23:16 +00:00
|
|
|
\section contains contains - test if a word is present in a list
|
2006-01-26 17:34:37 +00:00
|
|
|
|
|
|
|
\subsection contains-synopsis Synopsis
|
2014-08-01 12:25:41 +00:00
|
|
|
\fish{synopsis}
|
2014-08-01 02:37:32 +00:00
|
|
|
contains [OPTIONS] KEY [VALUES...]
|
|
|
|
\endfish
|
2006-01-26 17:34:37 +00:00
|
|
|
|
|
|
|
\subsection contains-description Description
|
|
|
|
|
2014-08-19 12:41:23 +00:00
|
|
|
`contains` tests whether the set `VALUES` contains the string `KEY`. If so, `contains` exits with status 0; if not, it exits with status 1.
|
2006-01-26 17:34:37 +00: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 07:56:01 +00:00
|
|
|
The following options are available:
|
2006-01-26 17:34:37 +00:00
|
|
|
|
2014-08-01 02:37:32 +00:00
|
|
|
- `-i` or `--index` print the word index
|
2006-01-26 17:34:37 +00:00
|
|
|
|
2014-08-19 12:41:23 +00:00
|
|
|
|
2006-01-26 17:34:37 +00:00
|
|
|
\subsection contains-example Example
|
2014-08-01 02:37:32 +00:00
|
|
|
|
|
|
|
\fish
|
2006-01-26 17:34:37 +00:00
|
|
|
for i in ~/bin /usr/local/bin
|
2014-08-01 02:37:32 +00:00
|
|
|
if not contains $i $PATH
|
|
|
|
set PATH $PATH $i
|
|
|
|
end
|
2006-01-26 17:34:37 +00:00
|
|
|
end
|
2014-08-01 02:37:32 +00:00
|
|
|
\endfish
|
2006-01-26 17:34:37 +00:00
|
|
|
|
2014-08-01 02:37:32 +00:00
|
|
|
The above code tests if `~/bin` and `/usr/local/bin` are in the path and adds them if not.
|