Trailing non-whitespace IFS doesn't generate an empty parameter (any more).

This commit is contained in:
dsl 2006-08-21 19:49:09 +00:00
parent eae5877e02
commit 1f9b387f1d

View File

@ -70,7 +70,9 @@ check 't=axb; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '2 a:b'
check 't="a x b"; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '2 a : b'
check 't="a xx b"; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '3 a :: b'
check 't="a xx b"; IFS="x "; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '3 a::b'
check 't="xax"; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '3 :a:'
# A recent 'clarification' means that a single trailing IFS non-whitespace
# doesn't generate an empty parameter
check 't="xax"; IFS="x"; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '2 :a'
check 'IFS="x"; set axb; IFS=":"; r="$*"; IFS=; echo $# $r' '1 axb'
# Check that we apply IFS to ${#var}