1set -e 2trap 'echo Broken pipe -- test failed' PIPE 3 4P=${TMPDIR:-/tmp} 5cd $P 6T=$(mktemp -d sh-test.XXXXXX) 7cd $T 8 9mkfifo input output error 10HISTFILE=/dev/null ${SH} +m -i <input >output 2>error & 11exec 3>input 12{ 13 # Command not found, containing slash 14 echo '/var/empty/nonexistent' >&3 15 # Read error message, shell will read new input now 16 read dummy <&5 17 # Execute bad command again 18 echo 'fc -e true; echo continued' >&3 19 read dummy <&5 20 read line <&4 && [ "$line" = continued ] && : ${rc:=0} 21 exec 3>&- 22 # Old sh duplicates itself after the fc, producing another line 23 # of output. 24 if read line <&4; then 25 echo "Extraneous output: $line" 26 rc=1 27 fi 28} 4<output 5<error 29exec 3>&- 30 31rm input output error 32rmdir ${P}/${T} 33exit ${rc:-3} 34