Created
March 15, 2019 05:05
-
-
Save renuka-fernando/a19790ad8900f02ead9de343b1d0d524 to your computer and use it in GitHub Desktop.
check regex of list of git repositories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
# Grep Here #################### | |
regex='<\s*script\s*language\s*' | |
# Grep Here #################### | |
repo_index=1 | |
declare -a repos=( | |
"[email protected]:renuka-fernando/sinhalese_language_racism_detection.git" | |
"[email protected]:renuka-fernando/hackgen.git" | |
"[email protected]:renuka-fernando/diabetes_data_warehouse.git" | |
"[email protected]:renuka-fernando/file_bucket.git" | |
) | |
for repo in "${repos[@]}" | |
do | |
echo "Checking Repo Index $repo_index" | |
git clone --recursive "$repo" | |
dir=$(grep -oP '(?<=/).*?(?=\.)' <<< "$repo") | |
if grep -iRqI "$regex" "./$dir/"; then | |
echo "FOUND IN : Repo Index: $repo_index - Repo: $repo" >> script_mediator.txt | |
echo "FOUND IN : Repo Index: $repo_index - Repo: $repo" | |
else | |
echo "Not Found in : Repo Index: $repo_index - Repo: $repo" >> script_mediator.txt | |
echo "Not Found in : Repo Index: $repo_index - Repo: $repo" | |
fi | |
repo_index=$(($repo_index + 1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment