1 2unset LC_ALL 3LC_CTYPE=en_US.ISO8859-1 4export LC_CTYPE 5 6# Note: the first and last characters are not whitespace. 7# Exclude backslash and newline. 8bad1=`printf %03o \'\\\\` 9bad2=`printf %03o \'' 10'` 11e= 12for i in 0 1 2 3; do 13 for j in 0 1 2 3 4 5 6 7; do 14 for k in 0 1 2 3 4 5 6 7; do 15 case $i$j$k in 16 000|$bad1|$bad2) continue ;; 17 esac 18 e="$e\\$i$j$k" 19 done 20 done 21done 22e=`printf "$e"` 23[ "${#e}" = 253 ] || echo length bad 24 25r1=`printf '%s\n' "$e" | { read -r x; printf '%s' "$x"; }` 26[ "$r1" = "$e" ] || echo "read with -r bad" 27r2=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }` 28[ "$r2" = "$e" ] || echo "read without -r bad 1" 29IFS= 30r3=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }` 31[ "$r3" = "$e" ] || echo "read without -r bad 2" 32