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