blob: e1beab3207451291d0745f674d7bc6fc8a9d4213 [file] [log] [blame]
# ${#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: ${#-} ${#_}