*** empty log message ***
[coreutils.git] / tests / tail-2 / start-middle
blob4dbe18900f526082affe98457b7405cde3890de1
1 #!/bin/sh
2 # Verify that tail works even when it's reading from a file
3 # that is not at its beginning. Based on a report from John Roll.
5 if test "$VERBOSE" = yes; then
6 set -x
7 tail --version
8 fi
10 pwd=`pwd`
11 tmp=tail-mid.$$
12 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
13 trap '(exit $?); exit' 1 2 13 15
15 framework_failure=0
16 mkdir $tmp || framework_failure=1
17 cd $tmp || framework_failure=1
19 (echo 1; echo 2) > k || framework_failure=1
21 if test $framework_failure = 1; then
22 echo "$0: failure in testing framework" 1>&2
23 (exit 1); exit 1
26 fail=0
28 sh -c 'read x; tail' < k > out || fail=1
29 cat <<EOF > exp
31 EOF
33 cmp out exp || fail=1
34 test $fail = 1 && diff out exp 2> /dev/null
36 (exit $fail); exit $fail