aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src/count.txt
blob: 7923ca00ad9a13da42da547abaecb6c832f583dc (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
27
28
29
\section count count - count the number of elements of an array

\subsection count-synopsis Synopsis
 <tt>count $VARIABLE</tt>

\subsection count-description Description

<tt>count</tt> 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.

\c count does not accept any options, including '-h'.

\c count exits with a non-zero exit status if no arguments were passed
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'.