xref: /freebsd/bin/sh/tests/builtins/fc1.0 (revision d0b2dbfa)
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
10ENV= HISTFILE=/dev/null ${SH} +m -i <input >output 2>error &
11{
12	# Syntax error
13	echo ')' >&3
14	# Read error message, shell will read new input now
15	read dummy <&5
16	# Execute bad command again
17	echo 'fc -e true' >&3
18	# Verify that the shell is still running
19	echo 'echo continued' >&3 || rc=3
20	echo 'exit' >&3 || rc=3
21	read line <&4 && [ "$line" = continued ] && : ${rc:=0}
22} 3>input 4<output 5<error
23
24rm input output error
25rmdir ${P}/${T}
26exit ${rc:-3}
27