find in glob, ignore glob added

This commit is contained in:
2021-09-27 16:20:47 +02:00
parent 037faf024e
commit baf79376c8
2 changed files with 13 additions and 0 deletions

12
bash/find-all-without.sh Normal file
View File

@@ -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"