diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ff	Sat Jun 06 10:19:04 2026 +0100
@@ -0,0 +1,46 @@
+#!/bin/sh
+# find any match from here
+if [ "$1" = "-d" ]
+then
+ shift
+ d="$1"
+ shift
+else
+ d=.
+fi
+if [ "$1" = "-L" ]
+then
+ shift
+ ll=-L
+else
+ ll=
+fi
+if [ "$1" = "-y" ]
+then
+ shift
+ yy=
+else
+ yy="-not ( -path ./Yesterday -prune )"
+fi
+if [ "$1" = "-0" ]
+then
+ shift
+ p=print0
+else
+ p=print
+fi
+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"
+if [ "$1" = "-?" ]
+then
+ printf "$usage"
+ exit 0
+fi
+if [ "${1:0:1}" = "-" ]
+then
+ printf "Additional args must be _after_ the pattern\n"
+ printf "$usage" 1>&2
+ exit 1
+fi
+ff=$1
+shift
+find $ll "$d" $yy \( \( -iname \*$ff\* \) -o \( -iname .\*$ff\* \) \) "$@" -$p