3 # Shell script used to test MINIX.
8 echo -n "Shell test 1 "
14 if test -r $f; then : ; else echo sh1 cannot
read $f; exit 1; fi
17 echo "abcdefghijklmnopqrstuvwxyz" >alpha
18 echo "ABCDEFGHIJKLMNOPQRSTUVWXYZ" >ALPHA
19 echo "0123456789" >num
20 echo "!@#$%^&*()_+=-{}[]:;<>?/.," >special
23 cat alpha ALPHA num rc passwd special
>tmp
29 cp /etc
/rc
/etc
/passwd foo
30 if cmp -s foo
/rc
/etc
/rc
; then : ; else echo Error on
cp test 1; fi
31 if cmp -s foo
/passwd
/etc
/passwd
; then : ; else echo Error on
cp test 2; fi
35 cat num num num num num
>y
38 if cmp -s x1 x2
; then : ; else echo Error on
cat test 1; fi
40 if cmp -s y z
; then : ; else echo Error on
cat test 2; fi
45 if cmp -s p q
; then : ; else echo Error on
ar test 1; fi
47 ar r x.a p q r
2>/dev
/null
53 if cmp -s p
/etc
/passwd
; then : ; else Error on
ar test 2; fi
54 if cmp -s q
/etc
/passwd
; then : ; else Error on
ar test 3; fi
55 if cmp -s r R
; then : ; else Error on
ar test 4; fi
56 if cmp -s cp /usr
/bin
/cp; then : ; else Error on
ar test 5; fi
57 if cmp -s cat /usr
/bin
/cat; then : ; else Error on
ar test 6; fi
61 if test -r r
; then echo Error on
ar test 7; fi
65 if test `basename /usr/ast/foo.c .c` != 'foo'
66 then echo Error on
basename test 1
69 if test `basename a/b/c/d` != 'd'; then Error on
basename test 2; fi
71 #Test cdiff, sed, and patch
72 cp $f x.c
# x.c is a copy $f
73 echo "/a/s//#####/g" >s
# create sed script
74 sed -f s
<x.c
>y.c
# y.c is new version of x.c
75 cdiff x.c y.c
>y
# y is cdiff listing
76 patch x.c y
2>/dev
/null
# z should be y.c
77 if cmp -s x.c y.c
; then : ; else echo Error
in cdiff
test; fi
81 ls /etc
>x
# x = list of /etc
82 grep -v "passwd" x
>y
# y = x except for /etc/passwd
83 comm -3 x y
>z
# should only be 1 line, /etc/passwd
85 if cmp -s w z
; then : else echo Error on
comm test 1; fi
87 comm -13 x y
>z
# should be empty
88 if test -s z
; then echo Error on
comm test 2; fi
92 compress -fc $f >x.c.Z
# compress the test file
93 compress -cd x.c.Z
>y
# uncompress it
94 if cmp -s $f y
; then : else echo Error
in compress test 1; fi
98 cp $f x
# copy $f to x
115 if cmp -s x
$f; then : ; else echo Error
in ed
test 1; fi
119 if test `expr 1 + 1` != 2; then echo Error on
expr test 1; fi
120 if test `expr 10000 - 1` != 9999; then echo Error on
expr test 2; fi
121 if test `expr 100 '*' 50` != 5000; then echo Error on
expr test 3; fi
122 if test `expr 120 / 5` != 24; then echo Error on
expr test 4; fi
123 if test `expr 143 % 7` != 3; then echo Error on
expr test 5; fi
126 if test $a != '101'; then echo Error on
expr test 6; fi
130 if cmp -s alpha z
; then : else echo Error on fgrep
test 1; fi
132 if test -s z
; then echo Error on fgrep
test 2; fi
135 if cmp -s w num
; then : ; else echo Error fgrep
test 3; fi
141 find .
-name Rabbit
-print >z
142 if cmp -s y z
; then : else echo Error on
find test 1; fi
143 find .
-name Bunny
-print >z
144 if test -s z
; then echo Error on
find test 2; fi
149 if cmp -s x alpha
; then : ; else echo Error on
grep test 1; fi
151 if test -s x
; then echo Error on
grep test 2; fi
153 if cmp -s x alpha
; then : ; else echo Error on
grep test 3; fi
155 if test -s x
; then echo Error on
grep test 4; fi
156 if grep -s "a" alpha
>x
; then : else echo Error on
grep test 5; fi
157 if grep -s "a" ALPHA
>x
; then echo Error on
grep test 6; fi
161 if cmp -s x alpha
; then : else echo Error on
head test 1; fi
164 if cmp -s x y
; then : else echo Error on
head test 2; fi
179 if cmp -s w w1
; then : ; else echo Error on
ls test 1; fi
186 if test -d Foo
; then : ; else echo Error on mkdir
test 1; fi
187 if test -d Bar
; then : ; else echo Error on mkdir
test 2; fi
189 if test -d Foo
; then echo Error on mkdir
test 3; fi
190 if test -d Foo
; then echo Error on
rmdir test 4; fi
197 if cmp -s $f z
; then : ; else echo Error on
mv test 1; fi
200 if cmp -s $f MVDIR
/y
; then : ; else echo Error on
mv test 2; fi
203 rev <f1 |
head -1 >ahpla
204 echo "zyxwvutsrqponmlkjihgfedcba" >x
205 if cmp -s x ahpla
; then : ; else echo Error on
rev test 1; fi
208 if cmp -s $f x
; then echo Error on
rev test 2; fi
209 if cmp -s $f y
; then : ; else echo error on
rev test 3; fi
219 if cmp -s w
$f; then : ; else echo Error on
shar test 1; fi
220 if cmp -s x alpha
; then : ; else echo Error on
shar test 2; fi
221 if cmp -s y ALPHA
; then : ; else echo Error on
shar test 3; fi
222 if cmp -s z num
; then : ; else echo Error on
shar test 4; fi
228 if cmp -s x1 x2
; then : ; else echo Error on
sort test 1; fi
251 if cmp -s y x1
; then : ; else echo Error on
sort test 2; fi
253 if cmp -s x2 z
; then : ; else echo Error on
sort test 3; fi
254 sort +1 -n <x |
head -1 >y
256 if cmp -s y z
; then : ; else echo Error on
sort test 4; fi
260 if cmp -s x special
; then : ; else echo Error on
tail test 1; fi
290 if cmp -s y answer
; then : ; else echo Error on
tsort test 1; fi
295 if test -s x.uue
; then : ; else echo Error on uue
/uud
test 1; fi
298 if cmp -s x
$f; then : ; else echo Error on uue
/uud
test 2; fi
300 compress -fc x
>x.Z
2>/dev
/null
305 if cmp -s x
$f; then : ; else echo Error on uue
/uud
test 3; fi