Multiple keyword search in multiple directories bash script

I guess the title is good enough :)
Probably you can do it in single grep command too.. but this way you will play with bash as well..

here is the bash script doing it

 #! /bin/bash
 dirs=(dir1 dir2 dir3 dir4 dir5)
 keywords=(keyword1 keyword2 keyword3 keyword4 keyword5)
 for word in "${keywords[@]}"; do
     strs+=" -e ${word} "
 for path in "${dirs[@]}"; do
     dirname="$(basename "${path}")"
     grep -ir --color ${strs} ${path}

Save this as

and you can run it as bash

See more on bash here