C (clang), 248248 209 bytes
#include <ftw.h>
#include <fnmatch.h>
#include#import <regex.h>
*l,i,j;*k;regex_t r;f(n,s,t){if(fnmatch("*.sh",n,0))return 0;k=fopen(n,"r");for(regcomp(&r,"^\\s*(#|$)",1);i=getline(&l,&i,k)>0;)regexec(&r,l,0,0,0)&&j++;}main(){ftw(".",f,1);printf("%d",j);}
-5 bytes thanks to @ceilingcat
-14 bytes thanks to @cleblanc
Added the necessary headers and made it start in the current directory