1#!/bin/bash 2 3[ -f testing.sh ] && . testing.sh 4 5mkdir dir 6cd dir 7touch file 8mkfifo fifo 9ln -s fifo link 10cd .. 11 12#testing "name" "command" "result" "infile" "stdin" 13 14# Testing operators 15 16testing "find -type l -a -type d -o -type p" \ 17 "find dir -type l -a -type d -o -type p" "dir/fifo\n" "" "" 18testing "find -type l -type d -o -type p" "find dir -type l -type d -o -type p" \ 19 "dir/fifo\n" "" "" 20testing "find -type l -o -type d -a -type p" \ 21 "find dir -type l -o -type d -a -type p" "dir/link\n" "" "" 22testing "find -type l -o -type d -type p" "find dir -type l -o -type d -type p" \ 23 "dir/link\n" "" "" 24testing "find -type l ( -type d -o -type l )" \ 25 "find dir -type l \( -type d -o -type l \)" "dir/link\n" "" "" 26testing "find extra parantheses" \ 27 "find dir \( \( -type l \) \( -type d -o \( \( -type l \) \) \) \)" \ 28 "dir/link\n" "" "" 29testing "find ( -type p -o -type d ) -type p" \ 30 "find dir \( -type p -o -type d \) -type p" "dir/fifo\n" "" "" 31testing "find -type l -o -type d -type p -o -type f" \ 32 "find dir -type l -o -type d -type p -o -type f | sort" \ 33 "dir/file\ndir/link\n" "" "" 34 35# Testing short-circuit evaluations 36 37testing "find -type f -a -print" \ 38 "find dir -type f -a -print" "dir/file\n" "" "" 39testing "find -print -o -print" \ 40 "find dir -type f -a \( -print -o -print \)" "dir/file\n" "" "" 41 42rm -rf dir 43