ajout fonctiondirMustContains
This commit is contained in:
15
functions.sh
15
functions.sh
@@ -80,6 +80,21 @@ if [ -d ${1} ] ; then echo -ne "0;"
|
|||||||
fi
|
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
|
# Ok if file contains at least one occurence of pattern
|
||||||
# arg1: file
|
# arg1: file
|
||||||
# arg2: pattern
|
# arg2: pattern
|
||||||
|
|||||||
Reference in New Issue
Block a user