comparison bin/ff @ 0:2aa53823fb21

new repo
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Sat, 06 Jun 2026 10:19:04 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:2aa53823fb21
1 #!/bin/sh
2 # find any match from here
3 if [ "$1" = "-d" ]
4 then
5 shift
6 d="$1"
7 shift
8 else
9 d=.
10 fi
11 if [ "$1" = "-L" ]
12 then
13 shift
14 ll=-L
15 else
16 ll=
17 fi
18 if [ "$1" = "-y" ]
19 then
20 shift
21 yy=
22 else
23 yy="-not ( -path ./Yesterday -prune )"
24 fi
25 if [ "$1" = "-0" ]
26 then
27 shift
28 p=print0
29 else
30 p=print
31 fi
32 usage="Usage: ff [-d where] [-L] [-y] [-0] pat ...\nfind pat anywhere in any name and print it\n -L follow links\n -y do look in Yesterday\n -0 use print0\n Anything after pat is included _before_ the final print(0)\n"
33 if [ "$1" = "-?" ]
34 then
35 printf "$usage"
36 exit 0
37 fi
38 if [ "${1:0:1}" = "-" ]
39 then
40 printf "Additional args must be _after_ the pattern\n"
41 printf "$usage" 1>&2
42 exit 1
43 fi
44 ff=$1
45 shift
46 find $ll "$d" $yy \( \( -iname \*$ff\* \) -o \( -iname .\*$ff\* \) \) "$@" -$p