From: Colin P. McCabe Date: Tue, 29 Nov 2022 21:07:19 +0000 (-0800) Subject: Add ff X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4fb215cf428f1fd85c15d29c5d3b6cfcca2e039;p=cmccabe-bin Add ff --- diff --git a/ff b/ff new file mode 100755 index 0000000..d4eddc7 --- /dev/null +++ b/ff @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# +# find first +# +# Prints out the first file which matches the given pattern in the current directory subtree. +# + +die() { + echo $@ + exit 1 +} + +[[ $# == 1 ]] || die "You must specify exactly one argument" +TOFIND=$1 +exec find . -name '*'${TOFIND}'*' -print -quit