From baf79376c80394b1d64e6cabc8feb6a0388fb74f Mon Sep 17 00:00:00 2001 From: Mastermindzh Date: Mon, 27 Sep 2021 16:20:47 +0200 Subject: [PATCH] find in glob, ignore glob added --- README.md | 1 + bash/find-all-without.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 bash/find-all-without.sh diff --git a/README.md b/README.md index 62c55ad..fa00d46 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ It also consolidates all relevant examples in 1 place ```sh . ├── bash +│ ├── find-all-without.sh # find all files with glob (*) whilst ignoring another glob (*) │ ├── parsing-command-line-params.sh │ ├── remove-parentheses.sh # script to remove parentheses from all files in a directory (recursively) │ └── whiptail.sh # tiny demo of how whiptail works diff --git a/bash/find-all-without.sh b/bash/find-all-without.sh new file mode 100644 index 0000000..0d7cd3b --- /dev/null +++ b/bash/find-all-without.sh @@ -0,0 +1,12 @@ +## this script shows you how to find files matching a certain glob (*.csproj) but ignoring another glob (*.test.csproj) + +CSPROJFILE=$(find . -iname '*.csproj' -a ! -iname '*test.csproj') +# ^ ^ ^ ^ ^ ^ ^ +# assign var | | | | | | +# find | | | | | +# case insensitive search | | | | +# ending with *.csproj | | | +# logical and not | | +# case insensitive name search | +# ending with test.csproj +echo "$CSPROJFILE"