1# $FreeBSD$ 2# POSIX leaves the effect of NUL bytes in command substitution output 3# unspecified but we have always discarded them. 4 5failures=0 6 7check() { 8 if [ "$2" != "$3" ]; then 9 printf "Failed at line %s: got \"%s\" expected \"%s\"\n" "$1" "$2" "$3" 10 : $((failures += 1)) 11 fi 12} 13 14fmt='\0a\0 \0b\0c d\0' 15assign_builtin=$(printf "$fmt") 16check "$LINENO" "$assign_builtin" "a bc d" 17assign_pipeline=$(printf "$fmt" | cat) 18check "$LINENO" "$assign_pipeline" "a bc d" 19set -- $(printf "$fmt") $(printf "$fmt" | cat) "$(printf "$fmt")" "$(printf "$fmt" | cat)" 20IFS=@ 21splits="$*" 22check "$LINENO" "$splits" "a@bc@d@a@bc@d@a bc d@a bc d" 23 24[ "$failures" = 0 ] 25