Skip to main content
Removed unneeded includes and replaced include with import
Source Link
user36046
user36046

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

Try it online!Try it online!

C (clang), 248 bytes

#include <ftw.h>
#include <fnmatch.h>
#include <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

Try it online!

C (clang), 248 209 bytes

#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);}

Try it online!

Added headers and starting in current working dir
Source Link
user36046
user36046

C (clang), 208 206 203 189248 bytes

#include <ftw.h>
#include <fnmatch.h>
#include <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(D".",f,1);printf("%d",j);}

-5 bytes thanks to @ceilingcat

-14 bytes thanks to @cleblanc

Try it online! Added the necessary headers and made it start in the current directory

Try it online!

C (clang), 208 206 203 189 bytes

*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(D,f,1);printf("%d",j);}

-5 bytes thanks to @ceilingcat

-14 bytes thanks to @cleblanc

Try it online!

C (clang), 248 bytes

#include <ftw.h>
#include <fnmatch.h>
#include <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

Try it online!

Remove type information in variable declarations
Source Link
user36046
user36046

C (clang), 208 206 203203 189 bytes

char i*l,ji,*l;regex_tj;*k;regex_t r;f(n,s,t)char*n;{if(fnmatch("*.sh",n,0))return 0;FILE*k=fopen0;k=fopen(n,"r");for(regcomp(&r,"^\\s*(#|$)",1);i=getline(&l,&i,k)>0;)regexec(&r,l,0,0,0)&&j++;}main(){ftw(D,f,1);printf("%d",j);}

-5 bytes thanks to @ceilingcat

Try it online!-14 bytes thanks to @cleblanc

Try it online!

C (clang), 208 206 203 bytes

char i,j,*l;regex_t r;f(n,s,t)char*n;{if(fnmatch("*.sh",n,0))return 0;FILE*k=fopen(n,"r");for(regcomp(&r,"^\\s*(#|$)",1);i=getline(&l,&i,k)>0;)regexec(&r,l,0,0,0)&&j++;}main(){ftw(D,f,1);printf("%d",j);}

-5 bytes thanks to @ceilingcat

Try it online!

C (clang), 208 206 203 189 bytes

*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(D,f,1);printf("%d",j);}

-5 bytes thanks to @ceilingcat

-14 bytes thanks to @cleblanc

Try it online!

added 1 character in body
Source Link
user36046
user36046
Loading
added 12 characters in body
Source Link
user36046
user36046
Loading
added 40 characters in body
Source Link
user36046
user36046
Loading
Fixed counting excluded lines
Source Link
user36046
user36046
Loading
Post Undeleted by user36046
Post Deleted by user36046
Source Link
user36046
user36046
Loading