#!/bin/sh # Shell script #2 used to test MINIX. PATH=:/bin:/usr/bin export PATH # CC="exec cc -wo -F" # nonstandard flags for ACK :-( CC=cc ARCH=`arch` echo -n "Shell test 2 " rm -rf DIR_SH2 mkdir DIR_SH2 # all files are created here cd DIR_SH2 cat >file <makefile </dev/null 2>&1 END cat >x.c < char s[] = {"MS-DOS: Just say no"}; /* used by strings later */ main() { int i; for (i = 15; i < 18; i++) printf("%d\\n",i*i); } END cat >answer <x if test -f x; then : ; else echo No compiler output; fi if cmp -s x answer; then : ; else echo Error in cc test 1; fi #Test chmod echo Hi there folks >x if test -r x; then : ; else echo Error on chmod test 1; fi chmod 377 x if test -r x; then test -w / || echo Error on chmod test 2; fi chmod 700 x if test -r x; then : ; else echo Error on chmod test 3; fi #Test cut cat >x <answer <y # extract columns 3-7 if cmp -s y answer; then : ; else echo Error in cut test 1; fi #Test dd dd if=$f of=x bs=12 count=1 2>/dev/null # x = bytes 0-11 dd if=$f of=y bs=6 count=4 skip=2 2>/dev/null # y = bytes 11-35 cat x y >z # z = bytes 0-35 dd if=$f of=answer bs=9 count=4 2>/dev/null # answer = bytes 0-35 if cmp -s z answer; then : ; else echo Error in dd test 1; fi #Test df # hard to make a sensible Test here rm ? df >x if test -r x; then : ; else echo Error in df Test 1; fi #Test du # see df rm ? du >x if test -r x; then : ; else echo Error in du Test 1; fi #Test od head -1 $f |od >x # see if od converts ascii to octal ok if [ $ARCH = i86 -o $ARCH = i386 ] then cat >answer <answer <x # see if od converts ascii to decimal ok if [ $ARCH = i86 -o $ARCH = i386 ] then cat >answer <answer <x <y <answer <z if cmp -s z answer; then : ; else echo Error in paste test 1; fi #Test prep echo >x <answer <x if grep HOME x >/dev/null; then : ; else echo Error in printenv test 1; fi if grep PATH x >/dev/null; then : ; else echo Error in printenv test 2; fi if grep SHELL x >/dev/null; then : ; else echo Error in printenv test 3; fi if grep USER x >/dev/null; then : ; else echo Error in printenv test 4; fi #Test pwd pwd >Pwd_file cd `pwd` pwd >x if test -s Pwd_file; then : ; else echo Error in pwd test 1; fi if cmp -s Pwd_file x; then : ; else echo Error in pwd test 2; fi #Test strings strings a.out | grep "MS-DOS" >x cat >answer <x cat >answer </dev/null if cmp -s x $f; then : ; else echo Error in tee test 1; fi #Test true if true ; then : ; else echo Error in true test 1; fi #Test uniq cat >x <answer <y if cmp -s y answer; then : ; else echo Error in uniq test 1; fi #Test pipelines cat >x <answer <y1 sort +1 y if cmp -s y answer; then : ; else echo Error in pipeline test 1; fi cat $f $f $f | sort | uniq >x sort <$f >y if cmp -s x y; then : ; else echo Error in pipeline test 2; fi cd .. rm -rf DIR_SH2 echo ok