summaryrefslogtreecommitdiffhomepage
path: root/shell/ash_test/ash-vars/param_expand_len1.tests
blob: e1beab3207451291d0745f674d7bc6fc8a9d4213 (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
30
31
# ${#c} for any single char c means "length of $c", including all special vars

false
echo One:${#?}
(exit 10)
echo Two:${#?}
(exit 100)
echo Three:${#?}

echo
echo One:${##}
set -- 1 2 3 4 5 6 7 8 9 0
echo Two:${##}
set -- 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 \
       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 \
       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 \
       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
echo Three:${##}

echo
v=$$
test "${#v}" = "${#$}"
echo 'Ok ${#$}:' $?

echo
sleep 0 &
v=$!
test "${#v}" = "${#!}"
echo 'Ok ${#!}:' $?

# TODO: ${#-} ${#_}