fish-shell/doc_src/count.txt

32 lines
768 B
Plaintext
Raw Normal View History

\section count count - count the number of elements of an array
\subsection count-synopsis Synopsis
2014-08-01 20:25:41 +08:00
\fish{synopsis}
count $VARIABLE
\endfish
\subsection count-description Description
`count` prints the number of arguments that were
passed to it. This is usually used to find out how many elements an
environment variable array contains.
`count` does not accept any options, including '`-h`'.
`count` exits with a non-zero exit status if no arguments were passed
2013-04-29 06:59:21 +08:00
to it, and with zero if at least one argument was passed.
\subsection count-example Example
<pre>
count $PATH
</pre>
returns the number of directories in the users PATH variable.
<pre>
count *.txt
</pre>
returns the number of files in the current working directory ending with the suffix '.txt'.