ajout fonctiondirMustContains

This commit is contained in:
2021-06-14 22:14:16 +02:00
parent 203d20bb11
commit d70db48add

View File

@@ -80,6 +80,21 @@ if [ -d ${1} ] ; then echo -ne "0;"
fi
}
# Ok if some files of given dir contains at least one occurence of pattern
# arg1: dir
# arg2: pattern
function dirMustContains {
dir=$1
shift
string=$@
if [ ! -d $dir ] ; then echo -ne "0;" ; return 0 ;fi
if ( grep -ri -qE "${string}" $dir ) ;
then echo -ne "1;"
else
echo -ne "0;"
fi
}
# Ok if file contains at least one occurence of pattern
# arg1: file
# arg2: pattern