File: word-multi-file

package info (click to toggle)
grep 2.6.3-3%2Bsqueeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 8,368 kB
  • ctags: 4,688
  • sloc: ansic: 15,006; sh: 8,554; makefile: 210; awk: 71; sed: 16
file content (30 lines) | stat: -rw-r--r-- 633 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# exercise the -w option on multiple files
# Derived from http://bugzilla.redhat.com/570500
: ${srcdir=.}
. "$srcdir/init.sh"; path_prepend_ ../src

mkdir a || framework_failure_
( cd a \
    && echo aa bb cc > 1 \
    && echo bb dd ff > 2 \
    && echo ff gg hh > 3 \
    && echo bb xx zz > 4 \
) || framework_failure_

cat << \EOF > exp1 || framework_failure_
a/1:aa bb cc
a/2:bb dd ff
a/4:bb xx zz
EOF
sed s/..// exp1 > exp2 || framework_failure_

fail=0
grep -rw bb a > out || fail=1
sort < out > k; mv k out
compare out exp1 || fail=1

(cd a && grep -w bb [1-4]) > out || fail=1
compare out exp2 || fail=1

Exit $fail