1# ${#c} for any single char c means "length of $c", including all special vars
2
3false
4echo One:${#?}
5(exit 10)
6echo Two:${#?}
7(exit 100)
8echo Three:${#?}
9
10echo
11echo One:${##}
12set -- 1 2 3 4 5 6 7 8 9 0
13echo Two:${##}
14set -- 1 2 3 4 5 6 7 8 9 0  1 2 3 4 5 6 7 8 9 0  1 2 3 4 5 6 7 8 9 0 \
15       1 2 3 4 5 6 7 8 9 0  1 2 3 4 5 6 7 8 9 0  1 2 3 4 5 6 7 8 9 0 \
16       1 2 3 4 5 6 7 8 9 0  1 2 3 4 5 6 7 8 9 0  1 2 3 4 5 6 7 8 9 0 \
17       1 2 3 4 5 6 7 8 9 0  1 2 3 4 5 6 7 8 9 0  1 2 3 4 5 6 7 8 9 0
18echo Three:${##}
19
20echo
21v=$$
22test "${#v}" = "${#$}"
23echo 'Ok ${#$}:' $?
24
25echo
26sleep 0 &
27v=$!
28test "${#v}" = "${#!}"
29echo 'Ok ${#!}:' $?
30
31# TODO: ${#-} ${#_}
32